Пример #1
0
 public void UpdateEndOfDayVariables(LemonadeStand lemonadeStand)
 {
     lemonadeStand.inventory.cups = cupCounter;
     lemonadeStand.money         += payingCustomers * lemonadeStand.recipe.price;
     lemonadeStand.inventory.ice  = 0;
     lemonadeStand.revenue       += (payingCustomers * lemonadeStand.recipe.price);
 }
Пример #2
0
 private void RunGameDays(Inventory inventory, LemonadeStand lemonadeStand, Store store, Day day, Random num)
 {
     for (double i = 1; i <= daysPlaying; i++)
     {
         day.payingCustomers = 0;
         day.RunDay(inventory, lemonadeStand, store, day, currentDay, num);
         this.currentDay += 1;
     }
 }
Пример #3
0
        public void DisplayStoreHighlight(double keyCounter, Inventory inventory, LemonadeStand lemonadeStand)
        {
            Console.WriteLine("Cups: " + inventory.cups + "   Lemons: " + inventory.lemons + "   Sugar: " + inventory.sugar + " cups" + "   Ice: " + inventory.ice + " Cubes" + "   Money:$" + lemonadeStand.money);
            switch (keyCounter)
            {
            case 0:
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("BUY CUPS");
                Console.ResetColor();
                Console.WriteLine("BUY LEMONS");
                Console.WriteLine("BUY SUGAR");
                Console.WriteLine("BUY ICE");
                Console.WriteLine("EXIT STORE");
                break;

            case 1:
                Console.WriteLine("BUY CUPS");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("BUY LEMONS");
                Console.ResetColor();
                Console.WriteLine("BUY SUGAR");
                Console.WriteLine("BUY ICE");
                Console.WriteLine("EXIT STORE");
                break;

            case 2:
                Console.WriteLine("BUY CUPS");
                Console.WriteLine("BUY LEMONS");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("BUY SUGAR");
                Console.ResetColor();
                Console.WriteLine("BUY ICE");
                Console.WriteLine("EXIT STORE");
                break;

            case 3:
                Console.WriteLine("BUY CUPS");
                Console.WriteLine("BUY LEMONS");
                Console.WriteLine("BUY SUGAR");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("BUY ICE");
                Console.ResetColor();
                Console.WriteLine("EXIT STORE");
                break;

            case 4:
                Console.WriteLine("BUY CUPS");
                Console.WriteLine("BUY LEMONS");
                Console.WriteLine("BUY SUGAR");
                Console.WriteLine("BUY ICE");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("EXIT STORE");
                Console.ResetColor();
                break;
            }
        }
Пример #4
0
 public Customers(double actualTemperature, string weatherCondition, LemonadeStand lemonadeStand, Day day, Random num)
 {
     chanceToBuy = 10;
     ActualTemperatureInfluence(actualTemperature);
     WeatherConditionInfluence(weatherCondition);
     PopularityInfluence(lemonadeStand.popularity);
     PriceInfluence(lemonadeStand.recipe.price);
     RecipeInfluence(lemonadeStand);
     DoesBuy(day, num);
 }
Пример #5
0
 public void UpdateCustomerSatisfaction(LemonadeStand lemonadeStand)
 {
     if ((lemonadeStand.customerSatisfaction + Math.Round((payingCustomers / 6))) < 100)
     {
         lemonadeStand.customerSatisfaction += Math.Round((payingCustomers / 6));
     }
     else
     {
         lemonadeStand.customerSatisfaction = 100;
     }
 }
Пример #6
0
        public Game()
        {
            Random num = new Random();

            DisplayRules();
            Console.Clear();
            lemonadeStandOne = new LemonadeStand();
            store            = new Store();
            day        = new Day();
            currentDay = 1;
            RunGameDays(lemonadeStandOne.inventory, lemonadeStandOne, store, day, num);
            DisplayEndGame(lemonadeStandOne);
        }
Пример #7
0
 public void RunDay(Inventory inventory, LemonadeStand lemonadeStand, Store store, Day day, int currentDay, Random num)
 {
     weather = new Weather();
     store.DisplayStore(inventory, lemonadeStand, weather, currentDay);
     lemonadeStand.SetRecipe();
     GetPossibleCustomers();
     this.cupCounter = inventory.cups;
     RunThroughCustomers(inventory, lemonadeStand, store, day, num);
     UpdateEndOfDayVariables(lemonadeStand);
     UpdatePopularity(lemonadeStand);
     UpdateCustomerSatisfaction(lemonadeStand);
     DisplayDayResults(weather.actualTemperature, weather.weatherCondition, lemonadeStand, currentDay);
 }
Пример #8
0
        public void DisplayStore(Inventory inventory, LemonadeStand lemonadeStand, Weather weather, double currentDay)
        {
            Console.WriteLine("The forecast Day " + currentDay + " is " + weather.forcastTemperature + " degrees and " + weather.weatherCondition + ".");
            Console.WriteLine("Use up and down arrow to navigate, press enter to look at item prices!");
            DisplayStoreHighlight(storeKeyCounter, inventory, lemonadeStand);
            var keyPressed = Console.ReadKey().Key;

            if (keyPressed == ConsoleKey.Enter)
            {
                if (storeKeyCounter == 4)
                {
                    Console.Clear();
                    return;
                }
                else
                {
                    Console.Clear();
                    DisplayItem(storeKeyCounter, itemKeyCounter, inventory, lemonadeStand);
                }
            }

            if (storeKeyCounter == 0)
            {
                if (keyPressed == ConsoleKey.DownArrow)
                {
                    storeKeyCounter += 1;
                }
            }
            else if (storeKeyCounter == 4)
            {
                if (keyPressed == ConsoleKey.UpArrow)
                {
                    storeKeyCounter -= 1;
                }
            }
            else if ((storeKeyCounter > 0) && (storeKeyCounter < 4))
            {
                if (keyPressed == ConsoleKey.UpArrow)
                {
                    storeKeyCounter -= 1;
                }
                else if (keyPressed == ConsoleKey.DownArrow)
                {
                    storeKeyCounter += 1;
                }
            }
            Console.Clear();
            DisplayStore(inventory, lemonadeStand, weather, currentDay);
        }
Пример #9
0
 public void RunThroughCustomers(Inventory inventory, LemonadeStand lemonadeStand, Store store, Day day, Random num)
 {
     for (double j = 0; j < possibleCustomers; j++)
     {
         if (j == 0 || pitcher == 10 || pitcher == 21 || pitcher == 32 || pitcher == 43 || pitcher == 54 || pitcher == 65 || pitcher == 76 || pitcher == 87 || pitcher == 98 || pitcher == 109)
         {
             UpdateInventory(lemonadeStand);
             pitcher++;
         }
         if (cupCounter > 0 && inventory.lemons > lemonadeStand.recipe.lemonsToUse && inventory.sugar > lemonadeStand.recipe.sugarToUse && inventory.ice > lemonadeStand.recipe.iceToUse)
         {
             Customers = new Customers(weather.actualTemperature, weather.weatherCondition, lemonadeStand, day, num);
         }
         else
         {
             return;
         }
     }
 }
Пример #10
0
        public void DisplaySugar(Inventory inventory, double itemKeyCounter, LemonadeStand lemonadeStand)
        {
            Console.WriteLine("Cups: " + inventory.cups + "   Lemons: " + inventory.lemons + "   Sugar: " + inventory.sugar + " cups" + "   Ice: " + inventory.ice + " Cubes" + "   Money:$" + lemonadeStand.money);
            switch (itemKeyCounter)
            {
            case 0:
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("8 Cups Sugar     $0.51");
                Console.ResetColor();
                Console.WriteLine("20 Cups Sugar    $1.64");
                Console.WriteLine("48 Cups Sugar    $3.28");
                Console.WriteLine("EXIT");
                break;

            case 1:
                Console.WriteLine("8 Cups Sugar     $0.51");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("20 Cups Sugar    $1.64");
                Console.ResetColor();
                Console.WriteLine("48 Cups Sugar    $3.28");
                Console.WriteLine("EXIT");
                break;

            case 2:
                Console.WriteLine("8 Cups Sugar     $0.51");
                Console.WriteLine("20 Cups Sugar    $1.64");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("48 Cups Sugar    $3.28");
                Console.ResetColor();
                Console.WriteLine("EXIT");
                break;

            case 3:
                Console.WriteLine("8 Cups Sugar     $0.51");
                Console.WriteLine("20 Cups Sugar    $1.64");
                Console.WriteLine("48 Cups Sugar    $3.28");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("EXIT");
                Console.ResetColor();
                break;
            }
        }
Пример #11
0
        public void DisplayIce(Inventory inventory, double itemKeyCounter, LemonadeStand lemonadeStand)
        {
            Console.WriteLine("Cups: " + inventory.cups + "   Lemons: " + inventory.lemons + "   Sugar: " + inventory.sugar + " cups" + "   Ice: " + inventory.ice + " Cubes" + "   Money:$" + lemonadeStand.money);
            switch (itemKeyCounter)
            {
            case 0:
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("100 Ice Cubes        $.88");
                Console.ResetColor();
                Console.WriteLine("250 Ice Cubes        $2.00");
                Console.WriteLine("500 Ice Cubes        $3.66");
                Console.WriteLine("EXIT");
                break;

            case 1:
                Console.WriteLine("100 Ice Cubes        $.88");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("250 Ice Cubes        $2.00");
                Console.ResetColor();
                Console.WriteLine("500 Ice Cubes        $3.66");
                Console.WriteLine("EXIT");
                break;

            case 2:
                Console.WriteLine("100 Ice Cubes        $.88");
                Console.WriteLine("250 Ice Cubes        $2.00");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("500 Ice Cubes        $3.66");
                Console.ResetColor();
                Console.WriteLine("EXIT");
                break;

            case 3:
                Console.WriteLine("100 Ice Cubes        $.88");
                Console.WriteLine("250 Ice Cubes        $2.00");
                Console.WriteLine("500 Ice Cubes        $3.66");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("EXIT");
                Console.ResetColor();
                break;
            }
        }
Пример #12
0
        public void DisplayLemons(Inventory inventory, double itemKeyCounter, LemonadeStand lemonadeStand)
        {
            Console.WriteLine("Cups: " + inventory.cups + "   Lemons: " + inventory.lemons + "   Sugar: " + inventory.sugar + " cups" + "   Ice: " + inventory.ice + " Cubes" + "   Money:$" + lemonadeStand.money);
            switch (itemKeyCounter)
            {
            case 0:
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("10 LemonS      $0.64");
                Console.ResetColor();
                Console.WriteLine("30 Lemons      $2.16");
                Console.WriteLine("75 Lemons      $4.19");
                Console.WriteLine("EXIT");
                break;

            case 1:
                Console.WriteLine("10 LemonS      $0.64");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("30 Lemons      $2.16");
                Console.ResetColor();
                Console.WriteLine("75 Lemons      $4.19");
                Console.WriteLine("EXIT");
                break;

            case 2:
                Console.WriteLine("10 LemonS      $0.64");
                Console.WriteLine("30 Lemons      $2.16");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("75 Lemons      $4.19");
                Console.ResetColor();
                Console.WriteLine("EXIT");
                break;

            case 3:
                Console.WriteLine("10 LemonS      $0.64");
                Console.WriteLine("30 Lemons      $2.16");
                Console.WriteLine("75 Lemons      $4.19");
                Console.BackgroundColor = ConsoleColor.Red;
                Console.WriteLine("EXIT");
                Console.ResetColor();
                break;
            }
        }
Пример #13
0
 public void UpdateInventory(LemonadeStand lemonadeStand)
 {
     lemonadeStand.inventory.lemons -= lemonadeStand.recipe.lemonsToUse;
     lemonadeStand.inventory.sugar  -= lemonadeStand.recipe.sugarToUse;
 }
Пример #14
0
 public void RecipeInfluence(LemonadeStand lemonadeStand)
 {
     chanceToBuy += LemonInfluence(lemonadeStand.recipe.lemonsToUse);
     chanceToBuy += SugarInfluence(lemonadeStand.recipe.sugarToUse);
     chanceToBuy += IceInfluence(lemonadeStand.recipe.iceToUse);
 }
Пример #15
0
 public void DisplayEndGame(LemonadeStand lemonadeStand)
 {
     Console.WriteLine("You made it to day " + daysPlaying + " and you made $" + lemonadeStand.money + "!");
 }
Пример #16
0
 public void DisplayDayResults(double actualTemperature, string weatherCondition, LemonadeStand lemonadeStand, double currentDay)
 {
     Console.WriteLine("The actual weather of day " + currentDay + " was " + actualTemperature + " and " + weatherCondition + ".");
     Console.WriteLine("");
     Console.WriteLine("You sold " + payingCustomers + " cups of lemonade to " + possibleCustomers + " possible customers!");
     Console.WriteLine("");
     Console.WriteLine("You made $" + (payingCustomers * lemonadeStand.recipe.price) + " today!  Your total revenue is $" + lemonadeStand.revenue + ".  Your total money is $" + lemonadeStand.money);
     Console.WriteLine("");
     Console.WriteLine("Your popularity is now at " + lemonadeStand.popularity + " and your customer satisfaction is at " + lemonadeStand.customerSatisfaction + "%!");
     Console.WriteLine("press enter to start your next day!");
     Console.WriteLine("");
     Console.BackgroundColor = ConsoleColor.Red;
     Console.WriteLine("NEXT DAY");
     Console.ResetColor();
     if (Console.ReadKey().Key == ConsoleKey.Enter)
     {
         Console.Clear();
         return;
     }
     else
     {
         DisplayDayResults(actualTemperature, weatherCondition, lemonadeStand, currentDay);
     }
 }
Пример #17
0
        public void DisplayItem(double storeKeyCounter, double itemKeyCounter, Inventory inventory, LemonadeStand lemonadeStand)
        {
            Console.WriteLine("Use up and down arrow to navigate, press enter to buy items!");
            switch (storeKeyCounter)
            {
            case 0:
                DisplayCup(inventory, itemKeyCounter, lemonadeStand);
                break;

            case 1:
                DisplayLemons(inventory, itemKeyCounter, lemonadeStand);
                break;

            case 2:
                DisplaySugar(inventory, itemKeyCounter, lemonadeStand);
                break;

            case 3:
                DisplayIce(inventory, itemKeyCounter, lemonadeStand);
                break;
            }

            var keyPress = Console.ReadKey().Key;

            if (keyPress == ConsoleKey.Enter)
            {
                if (itemKeyCounter == 3)
                {
                    return;
                }
                else
                {
                    UpdateInventory(storeKeyCounter, itemKeyCounter, inventory, lemonadeStand);
                }
            }

            if (itemKeyCounter == 0)
            {
                if (keyPress == ConsoleKey.DownArrow)
                {
                    itemKeyCounter += 1;
                }
            }
            else if (itemKeyCounter == 3)
            {
                if (keyPress == ConsoleKey.UpArrow)
                {
                    itemKeyCounter -= 1;
                }
            }
            else if ((itemKeyCounter > 0) && (itemKeyCounter < 3))
            {
                if (keyPress == ConsoleKey.UpArrow)
                {
                    itemKeyCounter -= 1;
                }
                else if (keyPress == ConsoleKey.DownArrow)
                {
                    itemKeyCounter += 1;
                }
            }
            Console.Clear();
            DisplayItem(storeKeyCounter, itemKeyCounter, inventory, lemonadeStand);
        }
Пример #18
0
 public void UpdatePopularity(LemonadeStand lemonadeStand)
 {
     lemonadeStand.popularity += Math.Round((payingCustomers / 10));
 }
Пример #19
0
        public void UpdateInventory(double storeKeyCounter, double itemKeyCounter, Inventory inventory, LemonadeStand lemonadeStand)
        {
            switch (storeKeyCounter)
            {
            case 0:
                switch (itemKeyCounter)
                {
                case 0:
                    if (lemonadeStand.money >= .86)
                    {
                        inventory.cups      += 25;
                        lemonadeStand.money -= .86;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }

                    break;

                case 1:
                    if (lemonadeStand.money >= 1.63)
                    {
                        inventory.cups      += 50;
                        lemonadeStand.money -= 1.63;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;

                case 2:
                    if (lemonadeStand.money >= 2.75)
                    {
                        inventory.cups      += 100;
                        lemonadeStand.money -= 2.75;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;
                }
                break;

            case 1:
                switch (itemKeyCounter)
                {
                case 0:
                    if (lemonadeStand.money >= .64)
                    {
                        inventory.lemons    += 10;
                        lemonadeStand.money -= .64;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;

                case 1:
                    if (lemonadeStand.money >= 2.16)
                    {
                        inventory.lemons    += 30;
                        lemonadeStand.money -= 2.16;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;

                case 2:
                    if (lemonadeStand.money >= 4.19)
                    {
                        inventory.lemons    += 75;
                        lemonadeStand.money -= 4.19;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;
                }
                break;

            case 2:
                switch (itemKeyCounter)
                {
                case 0:
                    if (lemonadeStand.money >= .51)
                    {
                        inventory.sugar     += 8;
                        lemonadeStand.money -= .51;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;

                case 1:
                    if (lemonadeStand.money >= 1.63)
                    {
                        inventory.sugar     += 20;
                        lemonadeStand.money -= 1.63;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;

                case 2:
                    if (lemonadeStand.money >= 3.28)
                    {
                        inventory.sugar     += 48;
                        lemonadeStand.money -= 3.28;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;
                }
                break;

            case 3:
                switch (itemKeyCounter)
                {
                case 0:
                    if (lemonadeStand.money >= .88)
                    {
                        inventory.ice       += 100;
                        lemonadeStand.money -= .88;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;

                case 1:
                    if (lemonadeStand.money >= 2.00)
                    {
                        inventory.ice       += 250;
                        lemonadeStand.money -= 2.00;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;

                case 2:
                    if (lemonadeStand.money >= 3.66)
                    {
                        inventory.ice       += 500;
                        lemonadeStand.money -= 3.66;
                    }
                    else
                    {
                        DisplayBrokePerson();
                    }
                    break;
                }
                break;
            }
        }