Esempio n. 1
0
        }        //end Main()

        //The Bake method requires two heating elements and a temperature
        //selected by the user.  It will operate until the user turns it off
        static void Bake()
        {
            int temperature;
            int endBake = 1;

            HeatingElement top, bottom;

            top    = new HeatingElement("top");
            bottom = new HeatingElement("bottom");

            Console.WriteLine("Please enter the desired temperature: ");
            temperature = int.Parse(Console.ReadLine());

            top.State    = "on";
            bottom.State = "on";

            Console.WriteLine("You are now baking...");
            Console.WriteLine(top.ReturnElementStatus());
            Console.WriteLine(bottom.ReturnElementStatus());
            Console.WriteLine("the temperature is " + temperature + " degrees");

            do
            {
                Console.WriteLine("Don't forget to turn off the oven by entering 0");
                endBake = int.Parse(Console.ReadLine());
            }while (endBake > 0);
        }        //end Bake()
Esempio n. 2
0
        }        //end Bake()

        //the broil method requires one burner operating on the top and operates until
        //the user turns the oven off
        static void Broil()
        {
            int endBroil = 1;

            HeatingElement top, bottom;

            top    = new HeatingElement("top");
            bottom = new HeatingElement("bottom");

            top.State    = "on";
            bottom.State = "off";

            Console.WriteLine("You are now broiling...");
            Console.WriteLine(top.ReturnElementStatus());
            Console.WriteLine(bottom.ReturnElementStatus());

            do
            {
                Console.WriteLine("Don't forget to turn off the oven by entering 0");
                endBroil = int.Parse(Console.ReadLine());
            }while (endBroil > 0);
        }        //end Broil()
Esempio n. 3
0
        }        //end Broil()

        //the toast method operates with both heating elements and will turn off
        //at a set time depending on the user selection of light, medium or dark toast
        static void Toast()
        {
            int toastSetting;
            int toastTime = 0;


            Console.WriteLine("How would you like your toast cooked?");
            Console.WriteLine("1. light\n2. medium\n3. dark");
            toastSetting = int.Parse(Console.ReadLine());

            switch (toastSetting)
            {
            case 1: toastTime = 5;
                Console.Write("toasting");
                break;

            case 2: toastTime = 10;
                Console.Write("toasting");
                break;

            case 3: toastTime = 15;
                Console.Write("toasting");
                break;

            default: toastTime = 30;
                Console.Write("hope you like burnt toast");
                break;
            }            //end switch

            for (int t = 0; t <= toastTime; t++)
            {
                Console.Write("...");
            }

            HeatingElement top, bottom;

            top    = new HeatingElement("top");
            bottom = new HeatingElement("bottom");
        }        //end Toast()