const int INITPACKAGE = 9;
static void Main(string[] args)
Console.WriteLine("Press 1 to convert Celsius to Farenheit.");
Console.WriteLine("Press 2 to calculate percentage of students in the class");
Console.WriteLine("Press 3 for baking ratios");
Console.WriteLine("Press 4 for gym rates");
Console.WriteLine("Press 5 for package prices and discounts");
Console.WriteLine("Press any other key to exit the program");
string menuSelect = Console.ReadLine();
double Farenheit, Celsius = 0;
Console.WriteLine("Converting Celsius to Farenheit.");
Console.WriteLine("Enter degrees in Celsius.");
while (!double.TryParse(Console.ReadLine(), out Celsius))
Console.WriteLine("Invalid input.");
Console.WriteLine("Enter degrees in Celsius");
Farenheit = 1.8 * Celsius + 32;
Console.WriteLine("It is {0} degrees Farenheit.", Farenheit);
int maleStudents = 0, femaleStudents = 0, totalStudents;
double percentMale, percentFemale;
Console.WriteLine("Calculating the percentage \nof male and female students.");
Console.WriteLine("Enter the number of male students.");
while (!int.TryParse(Console.ReadLine(), out maleStudents))
Console.WriteLine("Invalid input.");
Console.WriteLine("Enter the number of male students.");
Console.WriteLine("Enter the number of female students.");
while (!int.TryParse(Console.ReadLine(), out femaleStudents))
Console.WriteLine("Invalid input.");
Console.WriteLine("Enter the number of female students.");
totalStudents = maleStudents + femaleStudents;
percentMale = (double)maleStudents / totalStudents * 100;
percentFemale = (double)femaleStudents / totalStudents * 100;
Console.WriteLine("There are {0} male students, {1} female students, {2} total students.", maleStudents, femaleStudents, totalStudents);
Console.WriteLine("The class is {0}% male and {1}% female.", percentMale, percentFemale);
double Butter, Flour, Sugar;
Console.WriteLine("How many cookies do you want to bake?");
while (!int.TryParse(Console.ReadLine(), out Cookies))
Console.WriteLine("Invalid input.");
Console.WriteLine("How many cookies do you want to bake?");
Flour = (double)Cookies * 11 / 192;
Sugar = (double)Cookies / 32;
Butter = (double)Cookies / 48;
Console.WriteLine("To bake {0} cookies, you need {1} cups of flour, {2} cups of butter and {3} cups of sugar.", Cookies, Flour, Butter, Sugar);
int visitsGym = 0, totalMoney;
Console.WriteLine("How many times have you visited the gym?");
while (!int.TryParse(Console.ReadLine(), out visitsGym))
Console.WriteLine("Invalid input.");
Console.WriteLine("Enter the number of times you visited the gym");
totalMoney = 10 * 12 + ((visitsGym - 10) * 10);
totalMoney = visitsGym * 12;
Console.WriteLine("Total cost is {1}$ and you visited the gym {0} times.", visitsGym, totalMoney);
int unitsPackage = 0, discount;
double totalCost, discountValue;
Console.WriteLine("How many packages are you planning to buy?");
while (!int.TryParse(Console.ReadLine(), out unitsPackage))
Console.WriteLine("Invalid input.");
Console.WriteLine("Enter the amount of packages desired.");
totalCost = (double)99 * unitsPackage;
discountValue = 99 * 0.2;
totalCost = (double)99 * INITPACKAGE + ((99 - discountValue) * (unitsPackage - INITPACKAGE));
discountValue = 99 * 0.3;
totalCost = (double)99 * INITPACKAGE + (79.2 * 9) + ((99 - discountValue) * (unitsPackage - 19));
Console.WriteLine("The discount applied is {0}%, the total cost after discount is {1}$.", discount, totalCost);