コード例 #1
0
ファイル: Computer.cs プロジェクト: tprange11/Lemonade-Stand
 public override void GetLocation()
 {
     User_Interface.DisplayMessage("\nWhat city will Sophia's Lemonade Stand in?");
     city = User_Interface.GetUserInput();
     User_Interface.DisplayMessage("\nWhat state will Sophia's Lemonade Stand in?");
     state = User_Interface.GetUserInput();
 }
コード例 #2
0
        public void GetGameDuration()
        {
            User_Interface.ClearScreen();
            User_Interface.DisplayMessage("How long would you like to play?" +
                                          "\n\n\tPress 1 for 7 days." +
                                          "\n\n\tPress 2 for 14 days." +
                                          "\n\n\tPress 3 for 30 days.");
            switch (User_Interface.GetUserKey())
            {
            case "D1":
                User_Interface.DisplayMessage("\nYou choose to play for 7 days!");
                daysPlayed = 7;
                User_Interface.Wait();
                break;

            case "D2":
                User_Interface.DisplayMessage("\nYou choose to play for 14 days!");
                daysPlayed = 14;
                User_Interface.Wait();
                break;

            case "D3":
                User_Interface.DisplayMessage("\nYou choose to play for 30 days!");
                daysPlayed = 30;
                User_Interface.Wait();
                break;

            default:
                User_Interface.ClearScreen();
                User_Interface.DisplayMessage("\nInvalid choose. Press Enter to try again...");
                User_Interface.Wait();
                GetGameDuration();
                break;
            }
        }
コード例 #3
0
ファイル: Store.cs プロジェクト: tprange11/Lemonade-Stand
        public void BuyMoreLemons(Player player)
        {
            User_Interface.DisplayMessage("25 Lemmons for 0.89\tPress \"1\" to buy");
            User_Interface.DisplayMessage("50 Lemmons for 1.74\tPress \"2\" to buy");
            User_Interface.DisplayMessage("100 Lemmons for 3.20\tPress \"3\" to buy");
            switch (User_Interface.GetUserKey())
            {
            case "D1":
                if (player.GetWallet() >= 0.89)
                {
                    player.UpdateWallet(-0.89);
                }
                break;

            case "D2":
                if (player.GetWallet() >= 1.74)
                {
                    player.UpdateWallet(-1.74);
                }
                break;

            case "D3":
                if (player.GetWallet() >= 3.20)
                {
                    player.UpdateWallet(-3.20);
                }
                break;

            default:
                User_Interface.DisplayMessage("Please enter \"1\",\"2\" or \"3\".");
                EnterStore();
                break;
            }
        }
コード例 #4
0
        // member methods

        public void GetNumberOfCustomers(string weatherCondition)
        {
            Random rnd = new Random();

            switch (weatherCondition)
            {
            case "Clear":
                customers = rnd.Next(200, 300);
                break;

            case "Overcast":
            case "Partly Cloudy":
            case "Scattered Clouds":
                customers = rnd.Next(1, 200);
                break;

            case "Mostly Cloudy":
            case "Patches of Fog":
            case "Shallow Fog":
            case "Partial Fog":
                customers = rnd.Next(1, 100);
                break;

            case "Small Hail":
            case "Squalls":
            case "Funnel Cloud":
            case "Unknown Precipitation":
            case "Unknown":
            default:
                customers = rnd.Next(1, 50);
                break;
            }
            User_Interface.DisplayMessage("Number of customers: " + customers.ToString());
        }
コード例 #5
0
ファイル: Player.cs プロジェクト: tprange11/Lemonade-Stand
 public virtual void GetLocation()
 {
     User_Interface.DisplayMessage("\nWhat city is your Lemonade Stand in?");
     city = User_Interface.GetUserInput();
     User_Interface.DisplayMessage("\nWhat state is your Lemonade Stand in?");
     state = User_Interface.GetUserInput();
 }
コード例 #6
0
ファイル: Day.cs プロジェクト: mynameisfury/Lemonade-Stand
 public void DisplayWeather()
 {
     weather.DetermineRain(rng);
     if (weather.IsRaining == true)
     {
         User_Interface.MenuMessage = "It is raining";
         User_Interface.DisplayMessage();
     }
     else
     {
         User_Interface.MenuMessage = "It's clear";
         User_Interface.DisplayMessage();
     }
     weather.DetermineHumid(rng);
     if (weather.IsHumid == true)
     {
         User_Interface.MenuMessage = "It is humid";
         User_Interface.DisplayMessage();
     }
     else
     {
         User_Interface.MenuMessage = "It's not humid";
         User_Interface.DisplayMessage();
     }
 }
コード例 #7
0
ファイル: Player.cs プロジェクト: EHenderson421/LemonadeStand
        //Member Methods

        public void GetPlayerName()
        {
            User_Interface.DisplayMessage("Enter Your Name: ");

            nameInput = User_Interface.GetUserInput();
            name      = nameInput.ToUpper();
        }
コード例 #8
0
ファイル: Human.cs プロジェクト: tprange11/Lemonade-Stand
        public static string SelectOpponent()
        {
            string response;

            User_Interface.DisplayMessage("Would you like to play the computer?");
            response = User_Interface.GetUserInput();
            return(response);
        }
コード例 #9
0
ファイル: Inventory.cs プロジェクト: tprange11/Lemonade-Stand
 // member methods
 public void DisplayInventory()
 {
     User_Interface.DisplayMessage("\n***** SHOW INVENTORY *****");
     User_Interface.DisplayMessage("\tLemons:  " + lemons.ToString());
     User_Interface.DisplayMessage("\tSugar:  " + sugar.ToString());
     User_Interface.DisplayMessage("\tIce:  " + ice.ToString());
     User_Interface.DisplayMessage("\tCups:  " + cups.ToString());
 }
コード例 #10
0
ファイル: Player.cs プロジェクト: mynameisfury/Lemonade-Stand
        public void BuyItems()
        {
            User_Interface.MenuMessage = "What would you like to buy? ('lemons', 'cups', 'ice', 'sugar', or 'finish' to finish)";
            User_Interface.DisplayMessage();
            switch (Console.ReadLine())
            {
            case "lemons":
                User_Interface.MenuMessage = "How many would you like to buy? 15 cents each.";
                User_Interface.DisplayMessage();
                inventory.AddLemons(Convert.ToInt32(Console.ReadLine()));
                money -= (Lemon.price * inventory.numberOfLemons.Count);
                DisplayMoney();
                BuyItems();
                break;

            case "cups":
                User_Interface.MenuMessage = "How many would you like to buy? 4 cents each.";
                User_Interface.DisplayMessage();
                inventory.AddCups(Convert.ToInt32(Console.ReadLine()));
                money -= (Cup.price * inventory.numberOfCups.Count);
                DisplayMoney();
                BuyItems();
                break;

            case "ice":
                User_Interface.MenuMessage = "How many would you like to buy? 1 cent each.";
                User_Interface.DisplayMessage();
                inventory.AddIce(Convert.ToInt32(Console.ReadLine()));
                money -= (Ice.price * inventory.numberOfIceCubes.Count);
                DisplayMoney();
                BuyItems();
                break;

            case "sugar":
                User_Interface.MenuMessage = "How many would you like to buy? 10 cents each.";
                User_Interface.DisplayMessage();
                inventory.AddSugar(Convert.ToInt32(Console.ReadLine()));
                money -= (Sugar.price * inventory.numberOfSugar.Count);
                DisplayMoney();
                BuyItems();
                break;

            case "finish":
                break;

            //case "removesugar":
            //    inventory.RemoveSugar(Convert.ToInt32(Console.ReadLine()));
            //    break;
            default:
                Console.WriteLine("Invalid Input");
                BuyItems();
                break;
            }
        }
コード例 #11
0
        public double DetermineWillBuyWeather(double weatherTodayResult)
        {
            buyingCustomerWeather = 0;
            Random rnd = new Random();

            for (int i = 0; i < todaysCustomer; i++)
            {
                int weatherBuy = rnd.Next(0, 100);
                if (weatherTodayResult == 1)
                {
                    if (weatherBuy < 90)
                    {
                        willBuy = true;
                        buyingCustomerWeather++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (weatherTodayResult == 2)
                {
                    if (weatherBuy < 70)
                    {
                        willBuy = true;
                        buyingCustomerWeather++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (weatherTodayResult == 3)
                {
                    if (weatherBuy < 50)
                    {
                        willBuy = true;
                        buyingCustomerWeather++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }
            }

            buyingTodayWeather = buyingCustomerWeather++;
            User_Interface.DisplayMessage("Customers That walked up Today " + buyingTodayWeather);
            return(buyingTodayWeather);
        }
コード例 #12
0
 public void DisplayWeatherToday(double weatherTodayResult)
 {
     if (weatherTodayResult == 1)
     {
         User_Interface.DisplayMessage("Todays Weather is 'Sunny and Hot'");
     }
     else if (weatherTodayResult == 2)
     {
         User_Interface.DisplayMessage("Todays Weather is 'Cloudy and Cold'");
     }
     else
     {
         User_Interface.DisplayMessage("Todays Weather is 'Rainy'");
     }
 }
コード例 #13
0
        public bool CheckInventory()
        {
            if (lemon >= 1 && ice >= 1 && suger >= 1 && cup >= 1)
            {
                enoughInventory = true;
            }
            else
            {
                enoughInventory = false;

                User_Interface.DisplayMessage("You are out of Lemonade! You will need to restock for tomorrow");
            }

            return(enoughInventory);
        }
コード例 #14
0
 //Member Methods
 public void StartGame()
 {
     playerOne.GetPlayerName();
     User_Interface.DisplayMessage("Welcome To The Game: " + playerOne.name);
     weatherTodayResult = weatherToday.TodaysWeather();
     DisplayWeatherToday(weatherTodayResult);
     playerMoney            = money.DisplayMoneyInWallet();
     getSupplies            = buySupplies.BuyLemon();
     getSupplies            = buySupplies.BuyIce();
     getSupplies            = buySupplies.BuySuger();
     getSupplies            = buySupplies.BuyCup();
     pricePerCup            = chargePrice.InputPrice();
     numberOfCustomersToday = todaysCustomer.CustomersToday(weatherTodayResult);
     buyingCustomersWeather = todaysCustomer.DetermineWillBuyWeather(weatherTodayResult);
     buyTodayWeatherPrice   = todaysCustomer.DetermineWillBuyPrice(pricePerCup);
 }
コード例 #15
0
ファイル: Player.cs プロジェクト: mynameisfury/Lemonade-Stand
        public static int SetLemons()
        {
            try
            {
                User_Interface.MenuMessage = "How many lemons in a pitcher?";
                User_Interface.DisplayMessage();
                return(Convert.ToInt32(Console.ReadLine()));
            }
            catch (System.FormatException)
            {
                User_Interface.MenuMessage = "Invalid input.";
                User_Interface.DisplayMessage();

                SetLemons();
                return(0);
            }
        }
コード例 #16
0
        public bool DetermineHumid(Random rng)
        {
            if (rng.Next(0, 1) == 1)
            {
                bool IsHumid = true;
                return(true);

                User_Interface.MenuMessage = "It is humid";
                User_Interface.DisplayMessage();
            }
            else
            {
                bool IsHumid = false;
                return(false);

                User_Interface.MenuMessage = "It's not humid";
                User_Interface.DisplayMessage();
            }
        }
コード例 #17
0
 // member methods
 public void Introduction()
 {
     User_Interface.DisplayMessage(
         "You have 7, 14, or 21 days to make as much money as possible, and you’ve decided to open a lemonade stand!  " +
         "You’ll have complete control over your business, including pricing, quality control, inventory control, and " +
         "purchasing supplies.  Buy your ingredients, set your recipe, and start selling!\n\nThe first thing you’ll have " +
         "to worry about is your recipe.  At first, go with the default recipe, but try to experiment a little bit and see " +
         "if you can find a better one.Make sure you buy enough of all your ingredients, or you won’t be able to sell!\n\n" +
         "You’ll also have to deal with the weather, which will play a big part when customers are deciding whether or not to " +
         "buy your lemonade.  Read the weather report every day!  When the temperature drops, or the weather turns bad(overcast, " +
         "cloudy, rain), don’t expect them to buy nearly as much as they would on a hot, hazy day, so buy accordingly.  " +
         "Feel free to set your prices higher on those hot, muggy days too, as you’ll make more profit, even if you sell a bit " +
         "less lemonade.\n\nThe other major factor which comes into play is your customer’s satisfaction.  As you sell your " +
         "lemonade, people will decide how much they like or dislike it.  This will make your business more or less popular.  " +
         "If your popularity is low, fewer people will want to buy your lemonade, even if the weather is hot and sunny.  " +
         "But if you’re popularity is high, you’ll do okay, even on a rainy day!\n\nAt the end of 7, 14, or 21 days you’ll see " +
         "how much money you made.  Play again, and try to beat your high score!\n\n Press Enter to start.");
     User_Interface.GetUserInput();
 }
コード例 #18
0
        public bool DetermineRain(Random rng)
        {
            if (rng.Next(0, 1) == 1)
            {
                bool IsRaining = true;
                return(true);

                User_Interface.MenuMessage = "It is raining";
                User_Interface.DisplayMessage();
            }
            else
            {
                bool IsRaining = false;
                return(false);

                User_Interface.MenuMessage = "It's clear";
                User_Interface.DisplayMessage();
            }
        }
コード例 #19
0
        //Member Methods
        public double InputPrice()
        {
            User_Interface.DisplayMessage("How much would you like to charge for a cup of lemonade? example");
            User_Interface.DisplayMessage("example 50 cents would be .50, 1 dollor would be 1.00");
            chargePrice = double.Parse(User_Interface.GetUserInput());
            if (chargePrice <= 0.009)
            {
                User_Interface.DisplayMessage("Please Try Again");
                InputPrice();
            }
            else if (chargePrice >= 3.00)
            {
                User_Interface.DisplayMessage("Your price is a little high, and so are you!!!");
                User_Interface.DisplayMessage("Please Try Again");
                InputPrice();
            }

            User_Interface.DisplayMessage("Todays price per cup is " + chargePrice);
            return(chargePrice);
        }
コード例 #20
0
        //Member Methods

        public double CustomersToday(double weatherTodayResult)
        {
            Random rnd = new Random();

            if (weatherTodayResult == 1)
            {
                todaysCustomer = rnd.Next(50, 75);
            }
            else if (weatherTodayResult == 2)
            {
                todaysCustomer = rnd.Next(30, 60);
            }
            else if (weatherTodayResult == 3)
            {
                todaysCustomer = rnd.Next(20, 40);
            }

            User_Interface.DisplayMessage("Todays Customer Count " + todaysCustomer);

            return(todaysCustomer);
        }
コード例 #21
0
        public void GetPercentOfSales(int weatherTemp)
        {
            Random rnd = new Random();

            if (weatherTemp > 90)
            {
                percentSales = rnd.Next(80, 100);
            }
            else if (weatherTemp > 80)
            {
                percentSales = rnd.Next(70, 90);
            }
            else if (weatherTemp > 80)
            {
                percentSales = rnd.Next(50, 70);
            }
            else
            {
                percentSales = rnd.Next(1, 50);
            }
            User_Interface.DisplayMessage("Percent of customers the bought: " + percentSales.ToString());
        }
コード例 #22
0
ファイル: Store.cs プロジェクト: tprange11/Lemonade-Stand
        // member methods
        public bool GoingToStore()
        {
            bool   result = false;
            string answer;

            User_Interface.DisplayMessage("Do you need items from the store?");
            answer = User_Interface.GetUserInput();
            if (answer == "yes")
            {
                result = true;
            }
            else if (answer == "no")
            {
                result = false;
            }
            else
            {
                User_Interface.DisplayMessage("Please enter \"yes\" or \"no\".");
                GoingToStore();
            }
            return(result);
        }
コード例 #23
0
        public double BuyIce()
        {
            User_Interface.DisplayMessage("Your currantly have: " + inventory.ice + " servings of Ice");
            User_Interface.DisplayMessage("Ice cost $0.25 per serving. How many servings would you like to buy? ");
            restockChoice = int.Parse(User_Interface.GetUserInput());

            if (wallet.money - (restockChoice * .25) < 0)
            {
                User_Interface.DisplayMessage("Sorry you do not have enought money. Plese try again.");
                BuyIce();
            }
            else
            {
                inventory.ice = inventory.ice + restockChoice;
                wallet.money  = wallet.money - (restockChoice * .25);
                User_Interface.DisplayMessage("You are now restocked with Ice");
                User_Interface.DisplayMessage("You have " + inventory.ice + " servings of Ice.");
                User_Interface.DisplayMessage("you have $" + wallet.money + " left in you wallet.");
                return(inventory.ice);
            }

            return(wallet.money);
        }
コード例 #24
0
        public double BuyCup()
        {
            User_Interface.DisplayMessage("Your currantly have: " + inventory.cup + " Cups");
            User_Interface.DisplayMessage("Ice cost $.50 per cup. How many cups would you like to buy? ");
            restockChoice = int.Parse(User_Interface.GetUserInput());

            if (wallet.money - (restockChoice * .50) < 0)
            {
                User_Interface.DisplayMessage("Sorry you do not have enought money. Plese try again.");
                BuyCup();
            }
            else
            {
                inventory.cup = inventory.cup + restockChoice;
                wallet.money  = wallet.money - (restockChoice * .50);
                User_Interface.DisplayMessage("You are now restocked with Cups");
                User_Interface.DisplayMessage("You have " + inventory.cup + " Cups");
                User_Interface.DisplayMessage("you have $" + wallet.money + " left in you wallet.");
                return(inventory.cup);
            }

            return(wallet.money);
        }
コード例 #25
0
        public double BuyLemon()
        {
            User_Interface.DisplayMessage("Your currantly have: " + inventory.lemon + " Lemons ");
            User_Interface.DisplayMessage("Lemons cost $0.50 each. How many Lemons would you like to buy? ");
            restockChoice = int.Parse(User_Interface.GetUserInput());

            if (wallet.money - (restockChoice * .50) < 0)
            {
                User_Interface.DisplayMessage("Sorry you do not have enought money. Plese try again.");
                BuyLemon();
            }
            else
            {
                inventory.lemon = inventory.lemon + restockChoice;
                wallet.money    = wallet.money - (restockChoice * .50);
                User_Interface.DisplayMessage("You are now restocked with Lemons");
                User_Interface.DisplayMessage("You have " + inventory.lemon + " Lemons");
                User_Interface.DisplayMessage("you have $" + wallet.money + " left in you wallet.");
                return(inventory.lemon);
            }

            return(wallet.money);
        }
コード例 #26
0
ファイル: Store.cs プロジェクト: tprange11/Lemonade-Stand
        public string EnterStore()
        {
            string action = "continue";

            User_Interface.ClearScreen();
            User_Interface.DisplayMessage("Welcome to WALMART!  Get your SHIT and get OUT!\n");
            User_Interface.DisplayMessage("               Inventory/Purchase              ");
            User_Interface.DisplayMessage(" Lemons                          Press 1 to buy");
            User_Interface.DisplayMessage(" Cups of Sugar                   Press 2 to buy");
            User_Interface.DisplayMessage(" Ice Cubes                       Press 3 to buy");
            User_Interface.DisplayMessage(" Paper Cups                      Press 4 to buy");

            switch (User_Interface.GetUserKey())
            {
            case "D1":
                action = "lemons";
                break;

            case "D2":
                action = "sugar";
                break;

            case "D3":
                action = "ice";
                break;

            case "D4":
                action = "cups";
                break;

            default:
                User_Interface.DisplayMessage("Please enter \"1\",\"2\",\"3\" or \"4\".");
                EnterStore();
                break;
            }
            return(action);
        }
コード例 #27
0
        public double DetermineWillBuyPrice(double chargePrice)
        {
            buyingCustomerPrice = 0;
            Random rnd = new Random();

            for (int i = 0; i < buyingTodayWeather; i++)
            {
                int buyPrice = rnd.Next(0, 100);
                if (chargePrice > 0 && chargePrice <= .1)
                {
                    if (buyPrice < 100)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (chargePrice > .1 && chargePrice <= .5)
                {
                    if (buyPrice < 90)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (chargePrice > .5 && chargePrice <= .75)
                {
                    if (buyPrice < 80)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (chargePrice > .75 && chargePrice <= 1)
                {
                    if (buyPrice < 70)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (chargePrice > 1 && chargePrice <= 1.25)
                {
                    if (buyPrice < 60)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (chargePrice > 1.25 && chargePrice <= 1.5)
                {
                    if (buyPrice < 50)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }


                if (chargePrice > 1.5 && chargePrice <= 2)
                {
                    if (buyPrice < 40)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (chargePrice > 2 && chargePrice <= 2.5)
                {
                    if (buyPrice < 30)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }

                if (chargePrice > 2.5 && chargePrice <= 3)
                {
                    if (buyPrice < 20)
                    {
                        willBuy = true;
                        buyingCustomerPrice++;
                    }
                    else
                    {
                        willBuy = false;
                    }
                }
            }

            buyingCustomer = buyingCustomerPrice++;
            User_Interface.DisplayMessage("Customers That Bought Today " + buyingCustomer);
            return(buyingCustomer);
        }
コード例 #28
0
        //Member Methods

        public double DisplayMoneyInWallet()
        {
            User_Interface.DisplayMessage("You have $" + money + " Left in your Wallet");
            return(money);
        }
コード例 #29
0
ファイル: Player.cs プロジェクト: mynameisfury/Lemonade-Stand
 public static double SetPricePerCup()
 {
     User_Interface.MenuMessage = "In cents, how much per cup will you charge?";
     User_Interface.DisplayMessage();
     return(Convert.ToDouble(Console.ReadLine()) / 100);
 }
コード例 #30
0
ファイル: Player.cs プロジェクト: tprange11/Lemonade-Stand
 public virtual void SetPlayerName()
 {
     User_Interface.DisplayMessage("What is your name?\n");
     name = User_Interface.GetUserInput();
 }