예제 #1
0
        static void Main(string[] args)
        {
            Buffet     buffet = new Buffet();
            SweetTooth st     = new SweetTooth();
            SpiceHound sh     = new SpiceHound();

            while (!st.IsFull)
            {
                st.Consume(buffet.Serve());
            }
            st.Consume(buffet.Serve());

            while (!sh.IsFull)
            {
                sh.Consume(buffet.Serve());
            }
            sh.Consume(buffet.Serve());

            if (st.ConsumptionHistory.Count > sh.ConsumptionHistory.Count)
            {
                Console.WriteLine($"SweetTooth consumed more with {st.ConsumptionHistory.Count} items");
            }
            else if (st.ConsumptionHistory.Count < sh.ConsumptionHistory.Count)
            {
                Console.WriteLine($"SpiceHound consumed more with {sh.ConsumptionHistory.Count} items");
            }
            else
            {
                Console.WriteLine($"SweetTooth and SpiceHound both consumed {st.ConsumptionHistory.Count} items");
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            IConsumable rice        = new Food("Rice", 300, true, false);
            IConsumable banana      = new Food("Banana", 300, false, true);
            IConsumable cholotaCake = new Food("Chocolate Cake", 700, false, true);
            IConsumable borcsh      = new Food("Borcsh", 600, false, false);
            IConsumable lasagna     = new Food("Lasagna", 600, false, false);
            IConsumable ramen       = new Food("Ramen", 400, true, false);
            IConsumable burger      = new Food("Burger", 800, false, false);
            IConsumable milkShake   = new Drink("Milk Shake", 700, false);
            IConsumable coke        = new Drink("Coke", 300, false);
            IConsumable pepsi       = new Drink("Pepsi", 300, false);
            IConsumable tea         = new Drink("London Fog", 700, false);
            Buffet      SongsBuffet = new Buffet();

            SongsBuffet.AddToMenu(rice);
            SongsBuffet.AddToMenu(cholotaCake);
            SongsBuffet.AddToMenu(ramen);
            SongsBuffet.AddToMenu(tea);
            SongsBuffet.AddToMenu(milkShake);

            Ninja sweetEater  = new SweetTooth();
            Ninja spiceHunter = new SpiceHound();

            System.Console.WriteLine("Sweet");
            sweetEater.Consume(SongsBuffet.Serve());
            sweetEater.Consume(SongsBuffet.Serve());
            sweetEater.Consume(SongsBuffet.Serve());
            sweetEater.Consume(SongsBuffet.Serve());
            sweetEater.Consume(SongsBuffet.Serve());
            System.Console.WriteLine("            ");
            System.Console.WriteLine("Spicy");
            spiceHunter.Consume(SongsBuffet.Serve());
            spiceHunter.Consume(SongsBuffet.Serve());
            spiceHunter.Consume(SongsBuffet.Serve());
            spiceHunter.Consume(SongsBuffet.Serve());

            System.Console.WriteLine("=====================");
            System.Console.WriteLine(spiceHunter.ConsumptionHistory.Count);
            System.Console.WriteLine(sweetEater.ConsumptionHistory.Count);
            if (spiceHunter.ConsumptionHistory.Count > sweetEater.ConsumptionHistory.Count)
            {
                System.Console.WriteLine($"SpiceHunter is the winner with {spiceHunter.ConsumptionHistory.Count} of dishes eaten");
            }
            else if (spiceHunter.ConsumptionHistory.Count == sweetEater.ConsumptionHistory.Count)
            {
                System.Console.WriteLine($"Looks like there is a tie with {spiceHunter.ConsumptionHistory.Count} == {sweetEater.ConsumptionHistory.Count}");
            }
            else
            {
                System.Console.WriteLine($"SweetEater is the winner with {sweetEater.ConsumptionHistory.Count} of dishes eaten");
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("!!!IRON NINJA!!!");

            Buffet     word  = new Buffet();
            SweetTooth drew  = new SweetTooth("Drew");
            SpiceHound david = new SpiceHound("David");

            while (!drew.IsFull || !david.IsFull)
            {
                drew.Consume(word.Serve());
                david.Consume(word.Serve());
            }
            Console.WriteLine($"Drew scarffed down {drew.ConsumptionHistory.Count} items.\nDavid scarffed down {david.ConsumptionHistory.Count} items");

            if (drew.ConsumptionHistory.Count > david.ConsumptionHistory.Count)
            {
                Console.WriteLine("DREW WINS");
            }
            else if (david.ConsumptionHistory.Count > drew.ConsumptionHistory.Count)
            {
                Console.WriteLine("DAVID WINS");
            }
            else
            {
                Console.WriteLine("Andrew WINS");
            }
        }
예제 #4
0
        static void Main(string[] args)
        {
            Buffet buffet = new Buffet();
            // foreach(var item in buffet.Menu)
            // {
            //     Console.WriteLine($"{item.Name}: {item.Calories} Calories");
            // }
            SweetTooth SweetNinja = new SweetTooth();
            SpiceHound SpicyNinja = new SpiceHound();

            while (SweetNinja.IsFull == false)
            {
                SweetNinja.Consume(buffet.Serve());
                // foreach(var item in SweetNinja.ConsumptionHistory)
                // {
                //     Console.WriteLine($"Sweet ninja Just had {item.Name} calories of {item.Calories}.");
                // }
            }
            Console.WriteLine($"Sweet ninja had total {SweetNinja.ConsumptionHistory.Count} food!!!");
            while (SpicyNinja.IsFull == false)
            {
                SpicyNinja.Consume(buffet.Serve());
                Console.WriteLine(SpicyNinja.ConsumptionHistory.Count);
            }
            Console.WriteLine($"Spicy ninja had total {SpicyNinja.ConsumptionHistory.Count} food!!!");
        }
예제 #5
0
        static void Main(string[] args)
        {
            Buffet     MyBuffet   = new Buffet();
            SpiceHound SpiceNinja = new SpiceHound();
            SweetTooth SweetNinja = new SweetTooth();

            Console.WriteLine(SpiceNinja.IsFull);
            Console.WriteLine(SweetNinja.IsFull);

            while (!SpiceNinja.IsFull || !SweetNinja.IsFull)
            {
                SpiceNinja.Consume(MyBuffet.Serve());
                SweetNinja.Consume(MyBuffet.Serve());
            }

            if (SpiceNinja.ConsumptionHistory.Count > SweetNinja.ConsumptionHistory.Count)
            {
                Console.WriteLine("SpiceNinja has won!");
                Console.WriteLine($"SpiceNinja ate {SpiceNinja.ConsumptionHistory.Count} items");
            }
            else
            {
                Console.WriteLine("SweetNinja has won!");
                Console.WriteLine($"SweetNinja ate {SweetNinja.ConsumptionHistory.Count} items");
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            Buffet     myBuffet   = new Buffet();
            SweetTooth sweetTooth = new SweetTooth();
            SpiceHound spiceHound = new SpiceHound();
            int        count1     = 0;
            int        count2     = 0;

            while (sweetTooth.isFull == false)
            {
                sweetTooth.Consume(myBuffet.Serve());
                count1++;
            }

            while (spiceHound.isFull == false)
            {
                spiceHound.Consume(myBuffet.Serve());
                count2++;
            }

            if (count1 > count2)
            {
                Console.WriteLine($"SweetTooth consumed the most with {count1} items consumed.");
            }
            else if (count2 > count1)
            {
                Console.WriteLine($"SpiceHound consumed the most with {count2} items consumed.");
            }
            else
            {
                Console.WriteLine($"Both Ninjas consumed {count1} items.");
            }
        }
예제 #7
0
        static void Main(string[] args)
        {
            Buffet     myBuffet     = new Buffet();
            SweetTooth mySweetTooth = new SweetTooth();
            SpiceHound mySpiceHound = new SpiceHound();

            int sweetCount = 0;
            int spicyCount = 0;

            while (mySweetTooth.IsFull == false)
            {
                mySweetTooth.Consume(myBuffet.Serve());
                sweetCount++;
            }
            while (mySpiceHound.IsFull == false)
            {
                mySpiceHound.Consume(myBuffet.Serve());
                spicyCount++;
            }

            if (sweetCount > spicyCount)
            {
                System.Console.WriteLine("mySweetTooth has consumed the most items. Items consumed: " + sweetCount);
            }
            else
            {
                System.Console.WriteLine("mySpiceHound has consumed the most items. Items consumed: " + spicyCount);
            }
        }
예제 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("All you can eat!");
            Buffet GoldenCorral = new Buffet();
            Ninja  Dan          = new SweetTooth("Dan");
            Ninja  Drew         = new SpiceHound("Drew");

            while (Dan.IsFull == false)
            {
                Dan.Consume(GoldenCorral.Serve());
            }
            while (Drew.IsFull == false)
            {
                Drew.Consume(GoldenCorral.Serve());
            }
            if (Dan.ConsumptionHistory.Count > Drew.ConsumptionHistory.Count)
            {
                Console.WriteLine($"{ Dan.Name } consumed the most food and drink, { Dan.Name } wins!");
                Console.WriteLine($"{ Dan.Name } consumed { Dan.ConsumptionHistory.Count }. { Drew.Name } consumed { Drew.ConsumptionHistory.Count }.");
            }
            else if (Dan.ConsumptionHistory.Count == Drew.ConsumptionHistory.Count)
            {
                Console.WriteLine("Both Ninjas consumed the same amount. They are both little porkies!");
                Console.WriteLine($"{ Dan.Name } consumed { Dan.ConsumptionHistory.Count }. { Drew.Name } consumed { Drew.ConsumptionHistory.Count }.");
            }
            else
            {
                Console.WriteLine($"{ Drew.Name } ate the most food, { Drew.Name } wins!");
                Console.WriteLine($"{ Dan.Name } consumed { Dan.ConsumptionHistory.Count }. { Drew.Name } consumed { Drew.ConsumptionHistory.Count }.");
            }
        }
예제 #9
0
        static void Main(string[] args)
        {
            SweetTooth sweety   = new SweetTooth();
            SpiceHound spiceguy = new SpiceHound();
            Buffet     buffet   = new Buffet();

            while (!sweety.IsFull)
            {
                sweety.Consume(buffet.Serve());
            }

            while (!spiceguy.IsFull)
            {
                spiceguy.Consume(buffet.Serve());
            }

            Ninja  winner;
            string title;

            if (sweety.ConsumptionHistory.Count >= spiceguy.ConsumptionHistory.Count)
            {
                winner = sweety;
                title  = "Sweet Tooth";
            }
            else
            {
                winner = spiceguy;
                title  = "Spice Hound";
            }

            Console.WriteLine($"{title} is the winner, with {winner.ConsumptionHistory.Count} items consumed!");
        }
예제 #10
0
        static void Main(string[] args)
        {
            Buffet     buffet = new Buffet();
            SweetTooth st     = new SweetTooth();
            SpiceHound sh     = new SpiceHound();

            while (st.IsFull == false)
            {
                Random      rand    = new Random();
                int         randInt = rand.Next(0, buffet.Drinks.Count);
                IConsumable item    = buffet.Drinks[randInt];

                st.Consume(item);
            }

            while (sh.IsFull == false)
            {
                Random      rand    = new Random();
                int         randInt = rand.Next(0, buffet.Drinks.Count);
                IConsumable item    = buffet.Drinks[randInt];

                sh.Consume(item);
            }

            if (st.ConsumptionHistory.Count > sh.ConsumptionHistory.Count)
            {
                Console.WriteLine("The Sweet Tooth consumed the most items!!!");
            }
            else if (st.ConsumptionHistory.Count < sh.ConsumptionHistory.Count)
            {
                Console.WriteLine("The Spice Hound consumed the most items!!!");
            }
        }
예제 #11
0
        static void Main(string[] args)
        {
            Buffet     yummy = new Buffet();
            SweetTooth dylan = new SweetTooth();
            SpiceHound dude  = new SpiceHound();

            while (!dylan.IsFull)
            {
                dylan.Consume(yummy.Serve());
            }
            while (!dude.IsFull)
            {
                dude.Consume(yummy.Serve());
            }
            if (dylan.FoodHistory.Count > dude.FoodHistory.Count)
            {
                Console.WriteLine($"SweetTooth had the most items consumed with {dylan.FoodHistory.Count} items!");
                Console.Write("The SweetTooth ate the following: ");
                foreach (var food in dylan.FoodHistory)
                {
                    Console.Write($"{food.Name}: {food.Calories} cal; ");
                }
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine($"SpiceHound had the most items consumed with {dude.FoodHistory.Count} items!");
                Console.Write("The Spicehound ate the following: ");
                foreach (var food in dude.FoodHistory)
                {
                    Console.Write($"{food.Name}: {food.Calories} cal; ");
                }
                Console.WriteLine();
            }
        }
예제 #12
0
        static void Main(string[] args)
        {
            Buffet     buffet = new Buffet();
            SpiceHound sh     = new SpiceHound();
            SweetTooth swt    = new SweetTooth();

            while (!sh.IsFull)
            {
                sh.Consume(buffet.Serve());
            }

            while (!swt.IsFull)
            {
                swt.Consume(buffet.Serve());
            }

            Ninja  winner;
            string title;

            if (sh.FoodHistory.Count > swt.FoodHistory.Count)
            {
                winner = sh;
                title  = "Spice Hound";
            }
            else
            {
                winner = swt;
                title  = "Sweet Tooth";
            }

            Console.WriteLine($"{title} wins after finishing, {winner.FoodHistory.Count} items!");
        }
예제 #13
0
        static void Main(string[] args)
        {
            Buffet     buffet = new Buffet();
            SweetTooth st     = new SweetTooth();
            SpiceHound sh     = new SpiceHound();

            while (st.IsFull == false && buffet.Menu.Count > 0)
            {
                IConsumable item = buffet.Serve();
                st.Consume(item);
            }
            while (sh.IsFull == false && buffet.Menu.Count > 0)
            {
                IConsumable item = buffet.Serve();
                sh.Consume(item);
            }
            if (sh.ConsumptionHistory.Count > st.ConsumptionHistory.Count)
            {
                Console.WriteLine($"SpiceHound consumed the most from the buffet, {sh.ConsumptionHistory.Count} items!");
            }
            else
            {
                Console.WriteLine($"SweetTooth consumed the most from the buffet, {st.ConsumptionHistory.Count} items!");
            }
        }
예제 #14
0
        static void Main(string[] args)
        {
            Buffet     world = new Buffet();
            SweetTooth Gary  = new SweetTooth();
            SpiceHound Marco = new SpiceHound();

            Gary.Consume(world.Serve());
        }
예제 #15
0
        static void Main(string[] args)
        {
            Buffet     mybuffet = new Buffet();
            SweetTooth N1       = new SweetTooth();
            SpiceHound N2       = new SpiceHound();

            N1.Consume(mybuffet.Serve());
            N1.Consume(mybuffet.Serve());
            // while (!N1.IsFull)
            // {
            //     N1.Consume(mybuffet.Serve());
            // }
            // while (!N2.IsFull)
            // {
            //     N2.Consume(mybuffet.Serve());
            // }
        }
예제 #16
0
파일: Program.cs 프로젝트: Almaxz/IronNinja
        static void Main(string[] args)
        {
            Buffet     Chicking = new Buffet();
            SweetTooth l        = new SweetTooth("Leo");
            SpiceHound rj       = new SpiceHound("RJ");

            while (!l.IsFull)
            {
                l.Consume(Chicking.Serve());
            }
            l.Consume(Chicking.Serve());
            Console.WriteLine("\n=============================================================================================================================\n");
            while (!rj.IsFull)
            {
                rj.Consume(Chicking.Serve());
            }
            rj.Consume(Chicking.Serve());
        }
예제 #17
0
        static void Main(string[] args)
        {
            Buffet     royalFork = new Buffet();
            SweetTooth jack      = new SweetTooth();
            SpiceHound jill      = new SpiceHound();

            jack.Consume(royalFork.Serve());
            jill.Consume(royalFork.Serve());
        }
예제 #18
0
        static void Main(string[] args)
        {
            Buffet     b  = new Buffet();
            SweetTooth ay = new SweetTooth("Aytan");

            while (!ay.IsFull)
            {
                ay.Consume(b.Serve());
            }
            ay.Consume(b.Serve());
            Console.WriteLine("===================");
            SpiceHound rj = new SpiceHound("Ranjan");

            while (!rj.IsFull)
            {
                rj.Consume(b.Serve());
            }
            rj.Consume(b.Serve());
        }
예제 #19
0
        static void Main(string[] args)
        {
            Buffett    buffett1 = new Buffett();
            SweetTooth sweet1   = new SweetTooth();
            SpiceHound spice1   = new SpiceHound();
            int        sweet    = 0;
            int        spice    = 0;

            while (sweet < 1)
            {
                sweet1.Consume(buffett1.Serve());
                if (sweet1.IsFull == true)
                {
                    sweet1.Consume(buffett1.Serve());
                    sweet++;
                }
            }
            ;
            while (spice < 1)
            {
                spice1.Consume(buffett1.Serve());
                if (spice1.IsFull == true)
                {
                    spice1.Consume(buffett1.Serve());
                    spice++;
                }
            }
            ;
            //Console.WriteLine("this is the count for spice: " + spice1.ConsumptionHistory.Count);
            if (sweet1.ConsumptionHistory.Count > spice1.ConsumptionHistory.Count)
            {
                Console.WriteLine("Sweet1 has consumed more items than spice 1! The count was: " + sweet1.ConsumptionHistory.Count);
            }
            else if (sweet1.ConsumptionHistory.Count < spice1.ConsumptionHistory.Count)
            {
                Console.WriteLine("Spice1 has consumed more items than sweet 1! The count was: " + spice1.ConsumptionHistory.Count);
            }
            else
            {
                Console.Write("Both Spice1 and Sweet1 are tied at: " + spice1.ConsumptionHistory.Count);
            }
        }
예제 #20
0
        static void Main(string[] args)
        {
            //Ninja john = new Ninja();
            //Buffet entree = new Buffet();
            //john.Eat(entree.Serve());
            Buffet     entree = new Buffet();
            SweetTooth bill   = new SweetTooth();
            SpiceHound kim    = new SpiceHound();

            bill.Consume(entree.Serve());
            kim.Consume(entree.Serve());

            Console.WriteLine("Hello World!");
        }
예제 #21
0
        static void Main(string[] args)
        {
            Buffet     buffet  = new Buffet();
            SweetTooth swTooth = new SweetTooth();
            SpiceHound spHound = new SpiceHound();

            while (!swTooth.IsFull)
            {
                IConsumable swConsumable = buffet.Serve();
                swTooth.Consume(swConsumable);
            }
            Console.WriteLine($"SweetToooth consumed {swTooth.ConsumptionHistory.Count} items");
            while (!spHound.IsFull)
            {
                IConsumable spConsumable = buffet.Serve();
                spHound.Consume(spConsumable);
            }
            Console.WriteLine($"SpiceHound consumed {spHound.ConsumptionHistory.Count} items");
        }
예제 #22
0
        static void Main(string[] args)
        {
            Buffet     myBuffet     = new Buffet();
            SweetTooth mySweetTooth = new SweetTooth();
            SpiceHound mySpiceHound = new SpiceHound();

            while (!mySweetTooth.IsFull)
            {
                mySweetTooth.Consume(myBuffet.Serve());
            }
            Console.WriteLine($"Calorie intake is {mySweetTooth.CalorieAmount}. Ninja is full and cannot consume.");

            Console.WriteLine("**********");

            while (!mySpiceHound.IsFull)
            {
                mySpiceHound.Consume(myBuffet.Serve());
            }
            Console.WriteLine($"Calorie intake is {mySpiceHound.CalorieAmount}. Ninja is full and cannot consume.");
        }
예제 #23
0
        static void Main(string[] args)
        {
            SweetTooth tooth     = new SweetTooth("Hidetaka");
            SpiceHound hound     = new SpiceHound("Hideo");
            Buffet     newBuffet = new Buffet();

            while (!tooth.IsFull || !hound.IsFull)
            {
                tooth.Consume(newBuffet.Serve());
                hound.Consume(newBuffet.Serve());
            }
            if (tooth.IsFull)
            {
                Console.WriteLine($"{tooth.Name} consumed {tooth.ConsumptionHistory.Count} items");
            }
            else
            {
                Console.WriteLine($"{hound.Name} consumed {tooth.ConsumptionHistory.Count} items");
            }
        }
예제 #24
0
        static void Main(string[] args)
        {
            Buffet     buffet = new Buffet();
            SweetTooth st     = new SweetTooth();
            SpiceHound sh     = new SpiceHound();

            while (!st.IsFull)
            {
                st.Consume(buffet.Serve());
            }
            while (!sh.IsFull)
            {
                sh.Consume(buffet.Serve());
            }
            if (sh.ConsumptionHistory.Count > st.ConsumptionHistory.Count)
            {
                Console.WriteLine($"Spice Hound has {sh.ConsumptionHistory.Count} items.");
            }
            else
            {
                Console.WriteLine($"Sweet Tooth has {st.ConsumptionHistory.Count} items.");
            }
        }
예제 #25
0
        static void Main(string[] args)
        {
            Buffet     dinner   = new Buffet();
            SweetTooth dessert  = new SweetTooth();
            SpiceHound hotsauce = new SpiceHound();

            while (!dessert.IsFull)
            {
                dessert.Consume(dinner.Serve());
            }
            while (!hotsauce.IsFull)
            {
                hotsauce.Consume(dinner.Serve());
            }
            if (dessert.ConsumptionHistory.Count > hotsauce.ConsumptionHistory.Count)
            {
                Console.WriteLine($"SweetTooth has consumed {dessert.ConsumptionHistory.Count} items!");
            }
            else
            {
                Console.WriteLine($"SpiceHound has consumed {hotsauce.ConsumptionHistory.Count} items!");
            }
        }
예제 #26
0
        static void Main(string[] args)
        {
            Buffet b1     = new Buffet();
            Ninja  Goemon = new SweetTooth("Goemon");

            while (!Goemon.isFull)
            {
                Goemon.Consume(b1.Serve());
            }
            foreach (var item in Goemon.stomach)
            {
                Console.WriteLine($"{item.name} {item.calories}");
            }
            Ninja Kobayashi = new SpiceHound("Kobayashi");

            while (!Kobayashi.isFull)
            {
                Kobayashi.Consume(b1.Serve());
            }
            foreach (var item in Kobayashi.stomach)
            {
                Console.WriteLine($"{item.name} {item.calories}");
            }
            Console.WriteLine($"Goemon: {Goemon.stomach.Count}, Kobayashi: {Kobayashi.stomach.Count}");
            if (Goemon.stomach.Count > Kobayashi.stomach.Count)
            {
                Console.WriteLine("Goemon wins!");
            }
            else if (Goemon.stomach.Count < Kobayashi.stomach.Count)
            {
                Console.WriteLine("Kobayashi wins!");
            }
            else
            {
                Console.WriteLine("Nobody wins!");
            }
        }
예제 #27
0
        static void Main(string[] args)
        {
            Buffet     MyBuffet = new Buffet();
            SweetTooth Michael  = new SweetTooth();
            SpiceHound Ali      = new SpiceHound();

            while (Michael.IsFull != true)
            {
                IConsumable item = MyBuffet.Serve();
                Michael.Consume(item);
            }
            while (Ali.IsFull != true)
            {
                IConsumable item = MyBuffet.Serve();
                Ali.Consume(item);
            }
            int MichaelCount = Michael.ConsumptionHistory.Count;
            int AliCount     = Ali.ConsumptionHistory.Count;

            Console.WriteLine("                                                     ");
            Console.WriteLine("-----------------------------------------------------");
            Console.WriteLine("----------------------RESULTS------------------------");
            Console.WriteLine("-----------------------------------------------------");
            if (MichaelCount > AliCount)
            {
                Console.WriteLine($"Michael consumed {MichaelCount} items");
                Console.WriteLine($"Ali consumed {AliCount} items");
                Console.WriteLine($"MICHAEL CONSUMED THE MOST ITEMS!");
            }
            if (MichaelCount < AliCount)
            {
                Console.WriteLine($"Michael consumed {MichaelCount} items");
                Console.WriteLine($"Ali consumed {AliCount} items");
                Console.WriteLine($"ALI CONSUMED THE MOST ITEMS!");
            }
        }
예제 #28
0
        static void Main(string[] args)
        {
            // In your Program's Main method: instantiate a Buffet, a SweetTooth, and a SpiceHound
            Buffet     GoldenCorral = new Buffet();
            SweetTooth LeeAnn       = new SweetTooth();
            SpiceHound John         = new SpiceHound();

            // In your Program's Main method: have both the SweetTooth and Spice hound "Consume" from the Buffet until Full.
            while (!LeeAnn.IsFull)
            {
                LeeAnn.Consume(GoldenCorral.Serve());
            }
            Console.WriteLine("LeeAnn is full and cannot eat another bite!");
            while (!John.IsFull)
            {
                John.Consume(GoldenCorral.Serve());
            }
            Console.WriteLine("John is full and cannot eat another bite!");

            // In your Program's Main method: write to the console which of the two consumed the most items and the number of items consumed.
            int ItemsJohnConsumed   = John.ConsumptionHistory.Count;
            int ItemsLeeAnnConsumed = LeeAnn.ConsumptionHistory.Count;

            if (ItemsJohnConsumed > ItemsLeeAnnConsumed)
            {
                Console.WriteLine($"John consumed more items than LeeAnn. He ate {ItemsJohnConsumed} items");
            }
            else if (ItemsJohnConsumed < ItemsLeeAnnConsumed)
            {
                Console.WriteLine($"LeeAnn consumed more items than John. She ate {ItemsLeeAnnConsumed} items");
            }
            else
            {
                Console.WriteLine($"John and LeeAnn both ate {ItemsLeeAnnConsumed} items each.");
            }
        }
예제 #29
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome Ladies and Gentelman to a battle of the buldge(ing-stomach) that is!");
            Console.WriteLine("What you're about to witness is a battle of endurance, or as the french say endurance.");

            SweetTooth mitchell = new SweetTooth();

            Console.WriteLine("Our first contestant is the SweetTooth: Mitchell Golden, weighing in at a unflattering amount due to the one the only COVID-NINE*fadeway* TEEEEEENNNNNN");
            SpiceHound adrien = new SpiceHound();

            Console.WriteLine("For our second contender we have the SpiceHound: Adrien... DION!");
            Console.WriteLine("Let's Feast.");


            Buffet daBuffet = new Buffet();

            while (mitchell.IsFull == false && adrien.IsFull == false)
            {
                mitchell.Consume(daBuffet.Serve());
                adrien.Consume(daBuffet.Serve());
            }

            if (mitchell.ConsumptionHistory.Count == adrien.ConsumptionHistory.Count)
            {
                Console.WriteLine($"Could you believe it ladies and gentleman we have a TIE! Both Adrien and Mitchell have consumed {mitchell.ConsumptionHistory.Count} items!");
            }

            else if (mitchell.ConsumptionHistory.Count > adrien.ConsumptionHistory.Count)
            {
                Console.WriteLine($"And the winner is Mitchell consuming a whopping {mitchell.ConsumptionHistory.Count} items!");
            }
            else
            {
                Console.WriteLine($"And the winner is Adrien consuming a whopping {adrien.ConsumptionHistory.Count} items!");
            }
        }
예제 #30
0
        static void Main(string[] args)
        {
            Buffet     b1   = new Buffet();
            SweetTooth tim  = new SweetTooth();
            SpiceHound Josh = new SpiceHound();

            tim.Consume(b1.Serve());
            tim.Consume(b1.Serve());
            tim.Consume(b1.Serve());
            Josh.Consume(b1.Serve());
            Josh.Consume(b1.Serve());
            Josh.Consume(b1.Serve());
            tim.Consume(b1.Serve());
            tim.Consume(b1.Serve());
            tim.Consume(b1.Serve());
            Josh.Consume(b1.Serve());
            Josh.Consume(b1.Serve());
            Josh.Consume(b1.Serve());
        }