|
-
January 23rd, 2012, 05:47 AM
#1
private public
hello.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Uppgift_1
{
class Product
{
private string Produuct;
private decimal Price;
private decimal Vat;
private bool Food;
private int Count;
private const decimal foodVATRate = 0.12m, otherVATRate = 0.25m;
private decimal Finalprice;
private decimal Rate;
public void Readinput()
{
Console.Write("Made by ");
Console.Write("\n+++++++++++++++++++++++++++++++++++");
}
public void Readname()
{
Console.Write("\n\nWhat is the product you want: ");
Produuct = Console.ReadLine();
}
public void Readprice ()
{
Console.Write("Unit price: ");
decimal.TryParse(Console.ReadLine(), out Price);
}
public void readFooditem()
{
Console.Write("Food item y/n: ");
char answer = char.Parse(Console.ReadLine());
if ((answer == 'y') || (answer == 'Y'))
{
Food = true;
Vat = foodVATRate;
}
else
{
Food = false;
Vat = otherVATRate;
}
}
public void readcount()
{
Console.Write("Count: ");
int.TryParse(Console.ReadLine(), out Count);
}
public void readcalculate()
{
Finalprice =Price * Count;
Rate = Finalprice * Vat;
}
public void PrintRecept()
{
Console.Write("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++");
Console.Write("\n\nThe product you want is: " + Produuct);
Console.Write("\nThe price: "+ Price);
Console.Write("\nFood item: "+Food);
Console.Write("\nCount: "+Count);
Console.Write("\n\nTotal price: "+Finalprice);
Console.Write("\nVAT at "+ Rate);
Console.Write("\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
}
}
i need to change it so it looks like samthing like this.
public void start
{
readinput()
calculate()
printrecept()
}
private void readinput()
private void calculate()
private void printrecept()
But if i do this nothing will come up on the screen becous it is private
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|