コード例 #1
0
ファイル: Program.cs プロジェクト: devbaj/lang
        static void Main(string[] args)
        {
            Buffet     matsuri = new Buffet();
            SweetTooth bocchi  = new SweetTooth();
            SpiceHound satoka  = new SpiceHound();

            bocchi.Consume(matsuri.Serve());
            satoka.Consume(matsuri.Serve());
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Mark-Edwards-II/CSharp
        static void Main(string[] args)
        {
            Buffet oldCountry = new Buffet();
            Ninja  Dave       = new Ninja(450);

            while (Dave.IsFull == false)
            {
                Dave.Eat(oldCountry.Serve());
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: devbaj/lang
        static void Main(string[] args)
        {
            Buffet tucanos = new Buffet();
            Ninja  satoka  = new Ninja();

            while (!satoka.IsFull)
            {
                satoka.Eat(tucanos.Serve());
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Buffet World = new Buffet();
            Ninja  Paul  = new Ninja();

            while (!Paul.IsFull)
            {
                Paul.Eat(World.Serve());
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: fearnoevil7/CSharp
        static void Main(string[] args)
        {
            Random rando = new Random();

            Console.WriteLine("Hello World!");

            SpiceHound  Jonathon = new SpiceHound();
            SweetTooth  AJ       = new SweetTooth();
            Buffet      buffet1  = new Buffet();
            iConsumable food1    = buffet1.serve(rando.Next(1, 7));
            iConsumable food2    = buffet1.serve(rando.Next(1, 7));
            iConsumable food3    = buffet1.serve(rando.Next(1, 7));
            iConsumable food4    = buffet1.serve(rando.Next(1, 7));
            iConsumable food5    = buffet1.serve(rando.Next(1, 7));
            iConsumable food6    = buffet1.serve(rando.Next(1, 7));
            iConsumable food7    = buffet1.serve(rando.Next(1, 7));

            Console.WriteLine("Menu       !!!!!!!!");
            for (int x = 0; x < buffet1.menu.Count; x++)
            {
                Console.WriteLine(buffet1.menu[x].name);
            }

            Jonathon.Consume(food1);
            Jonathon.Consume(food2);
            Jonathon.Consume(food3);
            Jonathon.Consume(food4);
            Jonathon.Consume(food5);
            Jonathon.Consume(food6);
            Jonathon.Consume(food7);


            AJ.Consume(food1);
            AJ.Consume(food2);
            AJ.Consume(food3);
            AJ.Consume(food4);
            AJ.Consume(food5);
            AJ.Consume(food6);
            AJ.Consume(food7);
            Console.WriteLine(Jonathon.IsFull);
            Console.WriteLine(AJ.IsFull);
            Console.WriteLine("Consumption History       !!!!!!!!");
            for (int i = 0; i < Jonathon.ConsumptionHistory.Count; i++)
            {
                Console.WriteLine(Jonathon.ConsumptionHistory[i]);
            }
            if (Jonathon.ConsumptionHistory.Count > AJ.ConsumptionHistory.Count)
            {
                Console.WriteLine("Jonathon consumed the most items        : " + Jonathon.ConsumptionHistory.Count);
            }
            if (Jonathon.ConsumptionHistory.Count < AJ.ConsumptionHistory.Count)
            {
                Console.WriteLine("AJ consumed the most items        : " + AJ.ConsumptionHistory.Count);
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: kimheaktan/HungryNinja
        static void Main(string[] args)
        {
            Buffet Star = new Buffet();

            Ninja Slow = new Ninja();

            while (Slow.IsFull == false) // OR while(Slow.IsFull != true)
            {
                Slow.Eat(Star.Serve());
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: jsmalls05/C-Sharp-Practice
        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());
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: triebelscj/hungryNinja
        static void Main(string[] args)
        {
            Buffet buffet = new Buffet();
            Ninja  ninja  = new Ninja();

            while (!ninja.IsFull)
            {
                var food = buffet.Serve();
                ninja.Eat(food);
            }
            ninja.Eat(buffet.Serve());
            Console.WriteLine("ninja is full and cannot eat anymore!");
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: rbaermann/csHungryNinja
            static void Main(string[] args)
            {
                var Ryan  = new Ninja();
                var lunch = new Buffet();

                while (!Ryan.IsFull)
                {
                    Ryan.Eat(lunch.Serve());
                }
                foreach (var food in Ryan.FoodHistory)
                {
                    System.Console.WriteLine($"This Ninja ate: {food.Name} with {food.Calories} calories!");
                }
            }
コード例 #10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Buffet Resturant = new Buffet();
            // Resturant.Serve();
            Ninja Angelo = new Ninja("Angelo");

            System.Console.WriteLine($"Ninja Name: {Angelo.NinjaName}, Ninja Calorie: {Angelo.CalorieIntake}");
            Angelo.Eat(Resturant.Serve());
            Angelo.Eat(Resturant.Serve());
            Angelo.Eat(Resturant.Serve());
            Angelo.Eat(Resturant.Serve());

            System.Console.WriteLine($"Ninja Name: {Angelo.NinjaName}, Ninja Calorie: {Angelo.CalorieIntake}");
        }
コード例 #11
0
        static void Main(string[] args)
        {
            var cody      = new Ninja();
            var newBuffet = new Buffet();

            while (!cody.IsFull)
            {
                cody.Eat(newBuffet.Serve());
            }
            Console.WriteLine(cody);
            Console.Write("The Ninja ate the following: ");
            foreach (var food in cody.FoodHistory)
            {
                Console.Write($"{food.Name}: {food.Calories} cal; ");
            }
            Console.WriteLine();
        }
コード例 #12
0
        static void Main(string[] args)
        {
            Buffet Today = new Buffet();

            Console.WriteLine("_____________________");
            Ninja ninja1 = new SweetTooth();

            Console.WriteLine("_____________________");
            Ninja ninja2 = new SpiceHound();

            Console.WriteLine("_____________________");

            while (ninja1.isFull == false)
            {
                IConsumable meal1 = Today.Serve();
                meal1.GetInfo();
                ninja1.Consume(meal1);
            }
            while (ninja2.isFull == false)
            {
                IConsumable meal2 = Today.Serve();
                ninja2.Consume(meal2);
            }
            Console.WriteLine("_____________________");

            int count1 = ninja1.ConsumptionHistory.Count;

            Console.WriteLine(count1);

            int count2 = ninja2.ConsumptionHistory.Count;

            Console.WriteLine(count2);

            if (count1 > count2)
            {
                Console.WriteLine($"{ninja1} ninja consumed {count1} items");
            }
            if (count2 > count1)
            {
                Console.WriteLine($"{ninja2} ninja consumed {count2} items");
            }
            if (count2 == count1)
            {
                Console.WriteLine($"Both {ninja1} ninja and {ninja2} ninja consumed {count1} items");
            }
        }
コード例 #13
0
        static void Main(string[] args)
        {
            Random rando = new Random();

            Console.WriteLine("Hello World!");

            Ninja  ninja1  = new Ninja();
            Buffet buffet1 = new Buffet();
            Food   food1   = buffet1.serve(rando.Next(1, 7));
            Food   food2   = buffet1.serve(rando.Next(1, 7));
            Food   food3   = buffet1.serve(rando.Next(1, 7));
            Food   food4   = buffet1.serve(rando.Next(1, 7));
            Food   food5   = buffet1.serve(rando.Next(1, 7));
            Food   food6   = buffet1.serve(rando.Next(1, 7));
            Food   food7   = buffet1.serve(rando.Next(1, 7));

            Console.WriteLine("Menu       !!!!!!!!");
            for (int x = 0; x < buffet1.menu.Count; x++)
            {
                Console.WriteLine(buffet1.menu[x].name);
            }

            ninja1.Eat(food1);
            ninja1.Eat(food2);
            ninja1.Eat(food3);
            ninja1.Eat(food4);
            ninja1.Eat(food5);
            ninja1.Eat(food6);
            ninja1.Eat(food7);

            Console.WriteLine(ninja1.isFull);
            Console.WriteLine("Food History       !!!!!!!!");
            for (int i = 0; i < ninja1.FoodHistory.Count; i++)
            {
                Console.WriteLine(ninja1.FoodHistory[i].name);
            }
        }