Exemplo n.º 1
0
        public void start()
        {
            int daysInbusiness = UserInterface.DisplayWelcome();

            player1.name = UserInterface.DisplayName();


            for (int i = 1; i < daysInbusiness; i++)
            {
                Day day = new Day();
                day.name = i;
                days.Add(day);
            }

            foreach (Day startDay in days)
            {
                Console.WriteLine("Welcome to the Lemonade Store");
                StoreClass.Startg(player1);//Grabbing the current state of the player and displaying its inventory

                //for (int i = 0; i < 4; i++)
                Item purchasedItem;
                do
                {
                    purchasedItem = StoreClass.MenuPrompt();    //repeats purchase items untill finished

                    int amountPurchased = StoreClass.SetMenu(); //takes input of amount of items
                    for (int x = 0; x < amountPurchased; x++)
                    {
                        switch (purchasedItem.name)
                        {
                        case "Cup":
                            player1.PlayerInventory.cups.Add(new Cup(1));
                            player1.PlayerWallet.SetMoney(.10);
                            weeklyExpenses += .10;
                            break;

                        case "Lemon":
                            player1.PlayerInventory.lemons.Add(new Lemon(1));
                            player1.PlayerWallet.SetMoney(.20);
                            weeklyExpenses += .20;
                            break;

                        case "Ice Cube":
                            for (int j = 0; j <= 9; j++)
                            {
                                player1.PlayerInventory.icecubes.Add(new IceCube(1));
                            }
                            player1.PlayerWallet.SetMoney(1.00);
                            weeklyExpenses += 1.00;
                            break;

                        case "Sugar":
                            player1.PlayerInventory.sugarcubes.Add(new SugarCube(1));
                            player1.PlayerWallet.SetMoney(.12);
                            weeklyExpenses += .12;
                            break;

                        case "Start":
                            break;

                        default:
                            break;
                        }
                        //Add a tip writeline here for perfect ratio for recipe
                    }
                    Console.WriteLine("Money:" + player1.PlayerWallet.GetMoney());
                } while (purchasedItem.name != "Start"); //end of purchase loop


                purchasedItem = null;

                Console.WriteLine("Forecast " + startDay.DayWeather.condition);
                Console.WriteLine("Temperature " + startDay.DayWeather.temperature + "\n");
                Console.WriteLine("Inventory: " + "\n" + "Lemons: " + player1.PlayerInventory.lemons.Count + "\n" + "Sugar: " + player1.PlayerInventory.sugarcubes.Count + "\n" + "Ice Cubes: " + player1.PlayerInventory.icecubes.Count + "\n" + "Cups: " + player1.PlayerInventory.cups.Count + "\n");

                //recipe
                Console.WriteLine("Set the Recipe per Pitcher and Price per Cup");

                string[] recipeItems = new string[]
                { "Lemons", "Sugar Cubes", "Ice cubes", "Price per cup" };
                player1.PlayerRecipe.amountofLemons     = player1.PlayerRecipe.AskRecipe(recipeItems[0]);
                player1.PlayerRecipe.amountogSugarCubes = player1.PlayerRecipe.AskRecipe(recipeItems[1]);
                player1.PlayerRecipe.amountOfIceCubes   = player1.PlayerRecipe.AskRecipe(recipeItems[2]);
                player1.PlayerRecipe.pricePerCup        = player1.PlayerRecipe.AskPrice(recipeItems[3]);

                UserInterface.DisplayRecipe(recipeItems, player1.PlayerRecipe);
                Console.WriteLine("Press Enter to begin the Game!");
                Console.ReadLine();

                player1 = RunSimulation(player1, startDay);
            }

            Console.WriteLine(player1.name + " Your weekly profit: " + (player1.BusinessProfits) + "Total Customers:" + (weeklycustomers) + "Total Purchases:" + (weeklypurchases));
        }
Exemplo n.º 2
0
 public void StartPlayerSetup(Player player, Game game, Day currentDay, Weather CurrentWeather, UserInterface UI, Random random)
 {
     UI.CallAllChoosingLemonade(player, game, currentDay, CurrentWeather, UI, random);
 }
Exemplo n.º 3
0
        public void PrepareForDay(Player player1)
        {
            string response = UserInterface.DisplayTodaysMenu(player1, myWeather.CurrentTemp, myWeather.CurrentCondition).ToLower();

            switch (response)
            {
            case "1":
            case "see finances":
            case "see":
            case "finances":
            case "f":
            case "s":
                if (myReports.Count > 0)
                {
                    UserInterface.SeasonReports(myReports, dayCount - 1, "Use Left or Right arrows to scroll through reports.  'Enter' when done.");
                }
                else
                {
                    Console.WriteLine("Sorry, no reports available on your first day. Enter to continue.");
                    Console.ReadLine();
                }
                break;

            case "2":
            case "check weather":
            case "check":
            case "weather":
            case "c":
            case "w":
                UserInterface.GetTodaysWeatherReport(myWeather.CurrentTemp, myWeather.CurrentCondition, myWeather.FiveDayTemps, myWeather.FiveDayConditions);
                break;

            case "3":
            case "purchase supplies":
            case "purchase":
            case "supplies":
            case "p":
                player1.PurchaseProduct();
                break;

            case "4":
            case "prepare lemonade":
            case "prepare":
            case "lemonade":
            case "l":
                player1.MixLemonade();
                break;

            case "5":
            case "start day":
            case "start":
            case "day":
            case "go":
                RunThroughDay(player1);
                break;

            default:
                PrepareForDay(player1);
                break;
            }
        }
Exemplo n.º 4
0
 public void SetDesire(int rand1, int rand2)
 {
     CustomerDesire = UserInterface.RandomNumber(rand1, rand2);
 }
Exemplo n.º 5
0
 public void InUI()
 {
     UI = new UserInterface();
 }
Exemplo n.º 6
0
 public void EndDay()
 {
     totalDayProfit = player.wallet.Cash - startingCash;
     UserInterface.DisplayEndDayStats(purchasesMade, customers, weather, totalDayProfit);
 }
Exemplo n.º 7
0
 //constructor
 public Game()
 {
     startingBudget = 10;
     store          = new List <Store>();
     userInterface  = new UserInterface();
 }
Exemplo n.º 8
0
 public void SellLemonade(Day currentDay, Lemonade lemonade)
 {
     for (int i = 0; i < currentDay.PotentialCustomers.Count; i++)
     {
         if (currentDay.PotentialCustomers[i].MaxWillingToPay < lemonade.PricePerCup)
         {
             currentDay.PotentialCustomers[i].CupsBought = 0;
         }
         else if (currentDay.PotentialCustomers[i].MaxWillingToPay >= lemonade.PricePerCup)
         {
             if (currentDay.PotentialCustomers[i].LemonPreference == lemonade.LemonAmount && currentDay.PotentialCustomers[i].SugarPreference == lemonade.SugarAmount && currentDay.PotentialCustomers[i].IcePreference == lemonade.IceAmount)
             {
                 currentDay.PotentialCustomers[i].CupsBought = 3;
                 currentDay.Sales += (3 * lemonade.PricePerCup);
                 currentDay.Customers.Add(currentDay.PotentialCustomers[i]);
                 if (!inventory.RemoveLemons(3 * lemonade.LemonAmount))
                 {
                     UserInterface.AlertEmptyInventoryItem("lemons");
                     break;
                 }
                 if (!inventory.RemoveSugar(3 * lemonade.SugarAmount))
                 {
                     UserInterface.AlertEmptyInventoryItem("sugar");
                     break;
                 }
                 if (!inventory.RemoveIce(3 * lemonade.IceAmount))
                 {
                     UserInterface.AlertEmptyInventoryItem("ice");
                     break;
                 }
                 if (!inventory.RemoveCups(3))
                 {
                     UserInterface.AlertEmptyInventoryItem("cups");
                     break;
                 }
             }
             else
             {
                 int amount = random.Next(2);
                 if (amount == 0)
                 {
                     currentDay.PotentialCustomers[i].CupsBought = 0;
                 }
                 else if (amount == 1)
                 {
                     currentDay.PotentialCustomers[i].CupsBought = 1;
                     currentDay.Sales += lemonade.PricePerCup;
                     currentDay.Customers.Add(currentDay.PotentialCustomers[i]);
                     if (!inventory.RemoveLemons(lemonade.LemonAmount))
                     {
                         UserInterface.AlertEmptyInventoryItem("lemons");
                         break;
                     }
                     if (!inventory.RemoveSugar(lemonade.SugarAmount))
                     {
                         UserInterface.AlertEmptyInventoryItem("sugar");
                         break;
                     }
                     if (!inventory.RemoveIce(lemonade.IceAmount))
                     {
                         UserInterface.AlertEmptyInventoryItem("ice");
                         break;
                     }
                     if (!inventory.RemoveCups(1))
                     {
                         UserInterface.AlertEmptyInventoryItem("cups");
                         break;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 9
0
        public void MixLemonade()
        {
            int    amtLemons   = 0;
            int    amtSugar    = 0;
            int    amtIce      = 0;
            double price       = 0;
            int    numPitchers = 0;
            bool   mixDone     = false;
            string mixName     = " ";
            string message     = "How would you like to mix your own lemonade?";

            while (!mixDone)
            {
                UserInterface.MixLemonadeMenu(name, wallet, mySupplies, amtLemons, amtSugar, amtIce, price, numPitchers, mixName, message);
                string response = Console.ReadLine().ToLower().Trim();
                switch (response)
                {
                case "1":
                case "lemon":
                case "lemons":
                case "l":
                    numPitchers = 0;
                    amtLemons   = DetermineMixQty("Lemons", amtLemons, amtSugar, amtIce, price, mixName, numPitchers);
                    if (!EnoughToMix("Lemon", amtLemons))
                    {
                        message   = "You need to purchase more lemons. Please hit Enter.";
                        amtLemons = 0;
                        UserInterface.MixLemonadeMenu(name, wallet, mySupplies, amtLemons, amtSugar, amtIce, price, numPitchers, mixName, message);
                        Console.ReadLine();
                        message = "How would you like to mix your own lemonade ?";
                    }
                    break;

                case "2":
                case "sugar":
                case "sugars":
                case "s":
                    numPitchers = 0;
                    amtSugar    = DetermineMixQty("Sugar", amtLemons, amtSugar, amtIce, price, mixName, numPitchers);
                    if (!EnoughToMix("Sugar", amtSugar))
                    {
                        message  = "You need to purchase more sugar. Please hit Enter.";
                        amtSugar = 0;
                        UserInterface.MixLemonadeMenu(name, wallet, mySupplies, amtLemons, amtSugar, amtIce, price, numPitchers, mixName, message);
                        Console.ReadLine();
                        message = "How would you like to mix your own lemonade ?";
                    }
                    break;

                case "3":
                case "ice":
                case "ice cubes":
                case "i":
                    numPitchers = 0;
                    amtIce      = DetermineMixQty("Ice", amtLemons, amtSugar, amtIce, price, mixName, numPitchers);
                    if (!EnoughToMix("Ice", amtIce))
                    {
                        message = "You need to purchase more ice. Please hit Enter.";
                        amtIce  = 0;
                        UserInterface.MixLemonadeMenu(name, wallet, mySupplies, amtLemons, amtSugar, amtIce, price, numPitchers, mixName, message);
                        Console.ReadLine();
                        message = "How would you like to mix your own lemonade ?";
                    }
                    break;

                case "4":
                case "pitcher":
                case "pitchers":
                case "p":
                    numPitchers = DetermineMixQty("Pitchers", amtLemons, amtSugar, amtIce, price, mixName, numPitchers);
                    if (!EnoughForPitchers(amtLemons, amtSugar, amtIce, numPitchers))
                    {
                        message     = "You do not have enough supplies for that many pitchers. Please hit Enter.";
                        numPitchers = 0;
                        UserInterface.MixLemonadeMenu(name, wallet, mySupplies, amtLemons, amtSugar, amtIce, price, numPitchers, mixName, message);
                        Console.ReadLine();
                        message = "How would you like to mix your own lemonade ?";
                    }
                    break;

                case "5":
                case "price":
                case "money":
                    price = DeterminePriceFromUser(amtLemons, amtSugar, amtIce, price, mixName, numPitchers);
                    break;

                case "6":
                case "name":
                case "mix":
                    mixName = DetermineMixName(amtLemons, amtSugar, amtIce, price, mixName, numPitchers);
                    break;

                case "7":
                case "make":
                    if (numPitchers > 0)
                    {
                        message = "Confirm mixture, hit Enter.  Cancel Mix, type No";
                        UserInterface.ConfirmMixture(amtLemons, amtSugar, amtIce, price, numPitchers, mixName, message);
                        if (Console.ReadLine().ToLower().Trim() == "no")
                        {
                            message = "Nothing happened.  Update as needed.";
                        }
                        else
                        {
                            ProducePitchers(amtLemons, amtSugar, amtIce, numPitchers, price, mixName);
                            amtLemons   = 0;
                            amtSugar    = 0;
                            amtIce      = 0;
                            numPitchers = 0;
                            message     = "Done, All Mixed!";
                        }
                    }
                    break;

                case "8":
                case "leave":
                    mixDone = true;
                    break;

                case "9":
                case "done":
                    mixDone = true;
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 10
0
        public void PurchaseProduct()
        {
            string message = "What would you like to do?";

            UserInterface.PurchaseSuppliesMenu(name, wallet, mySupplies, mySupplier, message);
            string response = Console.ReadLine().ToLower().Trim();
            int    qty;

            switch (response)
            {
            case "1":
            case "lemon":
            case "lemons":
            case "l":
                qty = DetermineQuantityFromPlayer("Lemons");
                if (EnoughFundsToPurchase("Lemon", qty))
                {
                    AddSupplies("Lemon", qty);
                }
                else
                {
                    message = "You need to make more money for that many lemons. Please hit Enter.";
                    UserInterface.PurchaseSuppliesMenu(name, wallet, mySupplies, mySupplier, message);
                    Console.ReadLine();
                }
                PurchaseProduct();
                break;

            case "2":
            case "sugar":
            case "bag":
            case "bag of sugar":
            case "s":
                qty = DetermineQuantityFromPlayer("Sugar");
                if (EnoughFundsToPurchase("Sugar", qty))
                {
                    AddSupplies("Sugar", qty);
                }
                else
                {
                    message = "You need to make more money for that many cups of sugar. Please hit Enter.";
                    UserInterface.PurchaseSuppliesMenu(name, wallet, mySupplies, mySupplier, message);
                    Console.ReadLine();
                }
                PurchaseProduct();
                break;

            case "3":
            case "ice":
            case "cube":
            case "cube of ice":
            case "i":
                qty = DetermineQuantityFromPlayer("Ice");
                if (EnoughFundsToPurchase("Ice", qty))
                {
                    AddSupplies("Ice", qty);
                }
                else
                {
                    message = "You need to make more money for that many cubes of ice. Please hit Enter.";
                    UserInterface.PurchaseSuppliesMenu(name, wallet, mySupplies, mySupplier, message);
                    Console.ReadLine();
                }
                PurchaseProduct();
                break;

            case "done":
            case "4":
                break;

            default:
                PurchaseProduct();
                break;
            }
        }