Hi
I am completely new to C#, so please bare with me ....
What I am like to do is to pass variable values between the methods below, and finally print the results in the last method. I have commented the code with explanation.
This is for test purposes and I must have a working example before my brain explode...
class Product
{
static void Main(string[] args)
{
Product objGet = new Product();
objGet.ReadInput();
Console.ReadLine();
}
private void ReadInput()
{
Console.Write(" Product name: ");
string ReadName = Console.ReadLine();
Console.Write(" Unit price: ");
double UnitPrice = Convert.ToDouble(Console.ReadLine());
Console.Write(" Unit count: ");
int UnitCount = Convert.ToInt32(Console.ReadLine());
Console.Write(" Food item y/n: ");
string ReadFoodItem = Console.ReadLine();
}
private double GetTaxRate()
{
// Taxrate variable should have data type double and can have 1 of 2 rates
// if the variable ReadFoodItem is "y" then TaxRate is 12
// if the variable ReadFoodItem is "n" then TaxRate is 25
// Also a conversion of ReadFoodItem from string to boolean
}
private void CalculateValues()
{
// This variable should have data type double
// TotalAmount = TaxRate * TotalPrice / 100
}
private void PrintResults()
{
// Print variable ReadName
// Print variable UnitCount
// Print calculation of variables UnitPrice * UnitCount
// Print variable ReadFoodItem
// Print variable TotalAmount
}
}