Looking for some help with a simple c# console application program (brief attached). I am working on an assignement and am really struggling to put the pieces together.
Here's what I have so far (having trouble with the array aspect to get the baseprice and also with strings converting into numbers):
static void Main(string[] args)
{
const double cost1 = 5;
const double cost2 = 3;
const double cost3 = 1.50;
const double pie = 3.14159;
double metrecost = 30;
const int SIZEMIN = 120;
const int SIZEMAX = 1000;
double radius;
string pizzasizeString;
double pizzasize;
double qualitycase;
double baseprice;
double pizzaprice;
string[] selectcase = { "Supreme", "Best Brand", "Regular" };
for (int i = 0; i < selectcase.Length; i++)
Console.WriteLine("{0} {1}", i + 1, selectcase[i]);
Console.Write("Please enter which type of pizza the customer would like to buy: ");
double.Parse(qualitycase) = Console.ReadLine(); // Read input
if (qualitycase == 1)
{
baseprice = cost1;
}
else if (qualitycase == 2)
{
baseprice = cost2;
}
else if (qualitycase == 3)
{
baseprice = cost3;
}
else
{
Console.WriteLine("That is an invalid choice please select option 1, 2 or 3");
}
{ //Calculate area and cost of pizza
do
{
Console.Write("Please enter the size of the pizza that the customer would like to buy between " + SIZEMIN + " and " + SIZEMAX + " :");
pizzasizeString = Console.ReadLine();
pizzasize = double.Parse(pizzasizeString);
} while (pizzasize < SIZEMIN || pizzasize > SIZEMAX);
radius = (pizzasize / 2) / 1000; //Size is diameter in mm so divide by 2
//Divide by 100 to get metreage
pizzaprice = ((pie * (radius * radius)) * metrecost) + baseprice;
}
}
}
}
Any help would be greatly appreciated

New Topic/Question
Reply




MultiQuote







|