예제 #1
0
 public void Eat(Buffet item)
 {
     while (IsFull != true)
     {
         Food food = item.Serve();
         FoodHistory.Add(food);
         calorieIntake = calorieIntake + food.Calories;
         if (food.IsSpicy == true && food.IsSweet == true)
         {
             System.Console.WriteLine($"Ninja's eating {food.Name} with {food.Calories} calories and it's spicy and sweet.");
         }
         if (food.IsSpicy == true && food.IsSweet != true)
         {
             System.Console.WriteLine($"Ninja's eating {food.Name} with {food.Calories} calories and it's spicy.");
         }
         if (food.IsSpicy != true && food.IsSweet == true)
         {
             System.Console.WriteLine($"Ninja's eating {food.Name} with {food.Calories} calories and sweet.");
         }
         if (food.IsSpicy != true && food.IsSweet != true)
         {
             System.Console.WriteLine($"Ninja's eating {food.Name} with {food.Calories} calories.");
         }
     }
     System.Console.WriteLine($"Ninja is full, total calories: {this.calorieIntake}");
 }
예제 #2
0
        static void Main(string[] args)
        {
            Buffet     lux  = new Buffet();
            SweetTooth jack = new SweetTooth();
            SpiceHound john = new SpiceHound();

            jack.Consume(lux.Serve());
            System.Console.WriteLine(jack.isFull);

            jack.Consume(lux.Serve());
            System.Console.WriteLine(jack.isFull);

            john.Consume(lux.Serve());
            System.Console.WriteLine(john.isFull);
            john.Consume(lux.Serve());
            System.Console.WriteLine(john.isFull);
            john.Consume(lux.Serve());
            System.Console.WriteLine(john.isFull);

            if (jack.FoodHistory.Count > john.FoodHistory.Count)
            {
                foreach (IConsumable eat in jack.FoodHistory)
                {
                    System.Console.WriteLine(eat);
                }
            }
            else
            {
                foreach (IConsumable eat in john.FoodHistory)
                {
                    System.Console.WriteLine(eat.Name);
                }
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            Buffet myBuffet = new Buffet();
            Ninja  myNinja  = new Ninja();

            myNinja.Eat(myBuffet.Serve());
        }
예제 #4
0
        static void Main(string[] args)
        {
            Buffet     Meal = new Buffet();
            SweetTooth Alice = new SweetTooth();
            SpiceHound Yoda = new SpiceHound();
            int        count = 0, countsweet = 0, countspice = 0;
            string     name1, name2;

            while (!Alice.IsFull)
            {
                count++;
                countsweet++;
                Alice.Consume(Meal.Serve());
            }
            while (!Yoda.IsFull)
            {
                count++;
                countspice++;
                Yoda.Consume(Meal.Serve());
            }
            if (countsweet > countspice)
            {
                name1 = "SweetTooth Alice";
                name2 = "SpiceHound Yoda";
            }
            else
            {
                name1 = "SpiceHound Yoda";
                name2 = "SweetTooth Alice";
            }
            Console.WriteLine($"{name1} has consumed more than {name2} and the number of items consumed: {count}");
        }
예제 #5
0
        static void Main(string[] args)
        {
            Buffet      AllYouCanEat = new Buffet();
            SweetTooth  Dave         = new SweetTooth("Dave");
            SpiceHound  Rick         = new SpiceHound("Rick");
            IConsumable item         = AllYouCanEat.Serve();

            Dave.Consume(item);
            Dave.Consume(item);
            Dave.Consume(item);
            Dave.Consume(item);
            Dave.Consume(item);
            Rick.Consume(item);
            Rick.Consume(item);
            Rick.Consume(item);
            Rick.Consume(item);
            Rick.Consume(item);
            if (Dave.ConsumptionHistory.Count > Rick.ConsumptionHistory.Count)
            {
                Console.WriteLine($"Dave consumed {Dave.ConsumptionHistory.Count} items but Rick only had {Rick.ConsumptionHistory.Count}.");
            }
            else if (Rick.ConsumptionHistory.Count > Dave.ConsumptionHistory.Count)
            {
                Console.WriteLine($"Rick consumed {Rick.ConsumptionHistory.Count} items but Dave only had {Dave.ConsumptionHistory.Count}.");
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            Buffet     buffet = new Buffet();
            SpiceHound john   = new SpiceHound();
            SweetTooth jane   = new SweetTooth();

            Console.WriteLine(john.Consume(buffet.Serve()));
            Console.WriteLine(john.Consume(buffet.Serve()));
            Console.WriteLine(john.Consume(buffet.Serve()));
            Console.WriteLine(john.Consume(buffet.Serve()));
            Console.WriteLine(john.Consume(buffet.Serve()));
            Console.WriteLine(john.Consume(buffet.Serve()));
            Console.WriteLine(john.Consume(buffet.Serve()));
            Console.WriteLine(john.Consume(buffet.Serve()));

            Console.WriteLine("\n");

            Console.WriteLine(jane.Consume(buffet.Serve()));
            Console.WriteLine(jane.Consume(buffet.Serve()));
            Console.WriteLine(jane.Consume(buffet.Serve()));
            Console.WriteLine(jane.Consume(buffet.Serve()));
            Console.WriteLine(jane.Consume(buffet.Serve()));
            Console.WriteLine(jane.Consume(buffet.Serve()));
            Console.WriteLine(jane.Consume(buffet.Serve()));
            Console.WriteLine(jane.Consume(buffet.Serve()));
        }
예제 #7
0
        static void Main(string[] args)
        {
            Buffet OldCountryBuffet = new Buffet();
            // Console.WriteLine(OldCountryBuffet.Menu[0].Name);
            // Ninja tammi = new Ninja();
            SweetTooth child  = new SweetTooth();
            SpiceHound George = new SpiceHound();

            child.Nom(OldCountryBuffet.Serve());
            child.Nom(OldCountryBuffet.Serve());
            child.Nom(OldCountryBuffet.Serve());
            child.Nom(OldCountryBuffet.Serve());
            child.Nom(OldCountryBuffet.Serve());
            child.Nom(OldCountryBuffet.Serve());
            George.Nom(OldCountryBuffet.Serve());
            George.Nom(OldCountryBuffet.Serve());
            George.Nom(OldCountryBuffet.Serve());
            George.Nom(OldCountryBuffet.Serve());
            George.Nom(OldCountryBuffet.Serve());
            George.Nom(OldCountryBuffet.Serve());
            Console.WriteLine($"child ate {child.NomHistory.Count} foods/drinks!!!!!");
            Console.WriteLine($"George ate {George.NomHistory.Count} foods/drinks!!!!!");
            if (child.NomHistory.Count > George.NomHistory.Count)
            {
                System.Console.WriteLine("Child at more than G and he is lzr");
            }
            else if (child.NomHistory.Count < George.NomHistory.Count)
            {
                System.Console.WriteLine("G at more than child");
            }
            else
            {
                System.Console.WriteLine("G and child atttttt the same amount");
            }
        }
예제 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            // Test Food class:
            // Food Pizza = new Food("Pizza", 1200, true, false);
            // Console.WriteLine($"Name: {Pizza.Name}, Calories {Pizza.Calories}, Spicy: {Pizza.IsSpicy}, Sweet: {Pizza.IsSweet}.");

            // Test Buffet class:
            Buffet GoldenCorral = new Buffet();
            // Console.WriteLine(GoldenCorral.Serve().Name);
            // Console.WriteLine(GoldenCorral.Serve().Name);

            // Test Ninja class:
            Ninja Wadoo = new Ninja();

            //Console.WriteLine($"Calorie intake: {Wadoo.CalorieIntake}"); // Get method
            //Console.WriteLine($"Calorie intake: {Wadoo.CalorieIntake = 1201}"); // Set method
            //Console.WriteLine(Wadoo.IsFull); // IsFull method

            // In your Program's Main method, instantiate a Buffet and Ninja object, and have the Ninja eat until they are full!
            while (Wadoo.CalorieIntake < 1200)
            {
                Wadoo.Eat(GoldenCorral.Serve());
            }
            Wadoo.Eat(GoldenCorral.Serve());
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Ninja Buffet!");
            Buffet Yum = new Buffet();
            Ninja  Joe = new SpiceHound("Joe");
            Ninja  Moe = new SweetTooth("Moe");

            while (!Joe.IsFull || !Moe.IsFull)
            {
                Joe.Consume(Yum.Serve());
                Moe.Consume(Yum.Serve());
            }
            Console.WriteLine($"Joe ate {Joe.ConsumptionHistory.Count} items.\nMoe ate {Moe.ConsumptionHistory.Count} items.");
            if (Joe.ConsumptionHistory.Count > Moe.ConsumptionHistory.Count)
            {
                Console.WriteLine("Joe wins!");
            }
            else if (Moe.ConsumptionHistory.Count > Joe.ConsumptionHistory.Count)
            {
                Console.WriteLine("Moe wins!");
            }
            else
            {
                Console.WriteLine("It's a tie!");
            }
        }
예제 #10
0
        static void Main(string[] args)
        {
            Buffet     ayce  = new Buffet();
            SweetTooth alfie = new SweetTooth();
            SpiceHound gomez = new SpiceHound();

            alfie.Consume(ayce);
            foreach (IConsumable item in alfie.ConsumptionHistory)
            {
                Console.WriteLine(item.Name);
            }
            Console.WriteLine($"This ninja had {alfie.ConsumptionHistory.Count} items");
            Console.WriteLine("========================================");

            gomez.Consume(ayce);
            foreach (IConsumable item in gomez.ConsumptionHistory)
            {
                Console.WriteLine(item.Name);
            }
            Console.WriteLine($"This ninja had {gomez.ConsumptionHistory.Count} items");
            Console.WriteLine("========================================");

            if (alfie.ConsumptionHistory.Count > gomez.ConsumptionHistory.Count)
            {
                Console.WriteLine("Alfie had more items!");
            }
            else if (alfie.ConsumptionHistory.Count < gomez.ConsumptionHistory.Count)
            {
                Console.WriteLine("Gomez had more items!");
            }
            else
            {
                Console.WriteLine("Both ninjas had the same items");
            }
        }
예제 #11
0
        public static void Main(string[] args)
        {
            Buffet printBuffet = new Buffet();
            Ninja  person      = new Ninja();

            System.Console.WriteLine(person);
        }
예제 #12
0
        static void Main(string[] args)
        {
            Buffet mybuffet = new Buffet();
            Ninja  N1       = new Ninja();

            N1.Eat(mybuffet);
            // Food food = mybuffet.Serve();
            // System.Console.WriteLine($"{food.Name}");
        }
예제 #13
0
        static void Main(string[] args)
        {
            Buffet b1  = new Buffet();
            Ninja  tim = new Ninja();

            tim.Eat(b1.Serve());
            tim.Eat(b1.Serve());
            tim.Eat(b1.Serve());
            tim.Eat(b1.Serve());
        }
예제 #14
0
파일: Program.cs 프로젝트: denys-glu/CSharp
        static void Main(string[] args)
        {
            Ninja  Samurai = new Ninja();
            Buffet Pho     = new Buffet();

            Samurai.Eat(Pho.Serve());
            Samurai.Eat(Pho.Serve());
            Samurai.Eat(Pho.Serve());
            Samurai.Eat(Pho.Serve());
        }
예제 #15
0
        static void Main(string[] args)
        {
            Buffet royalFork = new Buffet();
            Ninja  sotomu    = new Ninja();

            while (!sotomu.IsFull)
            {
                sotomu.Eat(royalFork.Serve());
            }
        }
예제 #16
0
        static void Main(string[] args)
        {
            Buffet DojoCafe = new Buffet();
            Ninja  joe      = new Ninja();

            while (!joe.IsFull)
            {
                joe.Eat(DojoCafe.Serve());
            }
        }
예제 #17
0
        static void Main(string[] args)
        {
            Buffet b  = new Buffet();
            Ninja  ay = new Ninja("Aytan");

            while (!ay.IsFull)
            {
                ay.Eat(b.Serve());
            }
        }
예제 #18
0
        static void Main(string[] args)
        {
            Buffet buffet = new Buffet();
            Ninja  ninja  = new Ninja();

            while (!ninja.IsFull)
            {
                ninja.Eat(buffet.Serve());
            }
        }
        static void Main(string[] args)
        {
            Ninja  yudong     = new Ninja();
            Buffet stuffToEat = new Buffet();

            while (yudong.IsFull != true)
            {
                yudong.Eat(stuffToEat.Serve());
            }
        }
예제 #20
0
            static void Main(string[] args)
            {
                Buffet AYCE   = new Buffet();
                Ninja  Faisal = new Ninja();

                while (Faisal.IsFull != true)
                {
                    Faisal.Eat(AYCE.Serve());
                }
            }
예제 #21
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Ninja  n1 = new Ninja();
            Buffet b1 = new Buffet();
            Food   f1 = new Food("Salad", 2000, false, true);

            f1.Display();
            n1.Display();
        }
예제 #22
0
        static void Main(string[] args)
        {
            Buffet pigout = new Buffet();
            Ninja  Bobby  = new Ninja();

            Bobby.Eat(pigout.Serve());
            Bobby.Eat(pigout.Serve());
            Bobby.Eat(pigout.Serve());
            Bobby.Eat(pigout.Serve());
            Bobby.Eat(pigout.Serve());
        }
예제 #23
0
        static void Main(string[] args)
        {
            Buffet ninjaBuffet = new Buffet();
            Ninja  kirill      = new Ninja();

            while (kirill.isFull == false)
            {
                kirill.Eat(ninjaBuffet.Serve());
                Console.WriteLine($"Calories: {kirill.calories}\nYour ninja is full.");
            }
        }
예제 #24
0
        static void Main(string[] args)
        {
            Buffet mybuffet = new Buffet();
            Ninja  myNinja  = new Ninja();

            while (myNinja.IsFull == false)
            {
                myNinja.Eat(mybuffet.Serve());
            }
            System.Console.WriteLine("Done!");
        }
예제 #25
0
        static void Main(string[] args)
        {
            Ninja  mitchell = new Ninja("Mitchell");
            Buffet daBuffet = new Buffet();

            while (mitchell.isFull == false)
            {
                mitchell.Eat(daBuffet.Serve());
            }
            Console.WriteLine(mitchell.FoodHistory);
        }
예제 #26
0
        static void Main(string[] args)
        {
            Buffet Gege  = new Buffet();
            Ninja  Eddie = new Ninja(2200);

            while (!Eddie.IsFull)
            {
                Eddie.Eat(Gege.Serve());
            }
            Eddie.Eat(Gege.Serve());
        }
예제 #27
0
        static void Main(string[] args)
        {
            Ninja  Bryce    = new Ninja();
            Buffet hometown = new Buffet();

            Bryce.Eat(hometown.Serve());
            Bryce.Eat(hometown.Serve());
            Bryce.Eat(hometown.Serve());
            Bryce.Eat(hometown.Serve());
            Bryce.Eat(hometown.Serve());
        }
예제 #28
0
        static void Main(string[] args)
        {
            Buffet myBuffet = new Buffet();
            Ninja  myNinja  = new Ninja();

            do   // Continue eating until full
            {
                myNinja.Eat(myBuffet.Serve());
            } while (myNinja.isFull == false);
            myNinja.Eat(myBuffet.Serve()); // Eat one more time to console log that the ninja is full
        }
예제 #29
0
        static void Main(string[] args)
        {
            Buffet buffet = new Buffet();
            Ninja  ninja  = new Ninja();

            while (!ninja.isFull)
            {
                Food food = buffet.Serve();
                ninja.Eat(food);
            }
        }
예제 #30
0
        static void Main(string[] args)
        {
            // In your Program's Main method, instantiate a Buffet and Ninja object, and have the Ninja eat until they are full!
            Buffet ninjaBuffet = new Buffet();
            Ninja  alex        = new Ninja();

            while (alex.IsFull == false)
            {
                alex.Eat(ninjaBuffet.Serve());
            }
            Console.WriteLine($"Warning: calorie intake is {alex.CalorieAmount}. Ninja is full.");
        }