using System;
using System.Collections.Generic;
using System.Text;
namespace _303_fall_07_lecture_09
{
class Program
{
static void Main(string[] args)
{
string choice; // stores the user's choice for breakfast
choice = "";
while (choice != "QUIT")
{
// display the menu of choices
Console.WriteLine();
Console.WriteLine("Unhealthy breakfast choices");
Console.WriteLine(" SPAM. Spam and gravy");
Console.WriteLine(" EGGS. Eggs and toast with butter");
Console.WriteLine(" CAKE. Leftover cake and buttermilk");
Console.WriteLine(" QUIT");
// explicitly prompt user
Console.Write("Enter a choice (SPAM, EGGS, CAKE, QUIT) ");
// read in the user's choice
choice = Console.ReadLine();
// display back to the user what they chose
Console.WriteLine("You chose {0}", choice);
int calories_consumed = 0;
if (choice.ToUpper().StartsWith("S"))
{
Console.WriteLine("You chose spam and gravy");
calories_consumed += 600;
// same as :: calories_consumed = calories_consumed + 600;
}
else if ((choice == "EGGS") || (choice == "eggs"))
{
Console.WriteLine("You chose eggs and toast with butter");
calories_consumed += 400;
}
else if ((choice == "CAKE") || (choice == "cake"))
{
Console.WriteLine("You chose leftover cake and buttermilk");
calories_consumed += 800;
}
else if (choice != "QUIT") // invalid choice
{
Console.WriteLine("You didn't pick a valid choice");
}
Console.WriteLine("You ate {0} calories", calories_consumed);
}
}
}
}