Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Game      game       = new Game();
            Customer  customer1  = new Customer();
            Customer  customer2  = new Customer();
            Inventory inventory1 = new Inventory();
            Inventory inventory2 = new Inventory();
            Store     store      = new Store();
            Weather   weather1   = new Weather();
            Weather   weather2   = new Weather();
            string    action;

            Console.WriteLine("Introduciton:\n");
            game.Introduction();

            Player player1 = new Human();


            Player player2 = null;

            switch (Human.SelectOpponent().ToLower())
            {
            case "yes":
                player2 = new Computer();
                break;

            case "no":
                player2 = new Human();
                break;

            default:
                break;
            }
            game.GetGameDuration();
            User_Interface.DisplayMessage(message: "Player1: " + player1.DisplayPlayerName() + "\tPlayer2: " + player2.DisplayPlayerName());  //Remove this line when done.
            int i = 0;

            while (game.daysPlayed > 0)
            {
                i++;
                User_Interface.ClearScreen();
                User_Interface.DisplayMessage("day: " + i);

                DateTime dt      = DateTime.Now.AddDays(-game.daysPlayed);
                string   strDate = dt.ToString("yyyyMMdd");
                User_Interface.DisplayMessage("\t Weather date is: " + strDate);
                weather1.DisplayWeather(strDate, player1.city, player1.state);
                player1.DisplayInventory();

                while (store.GoingToStore())
                {
                    action = store.EnterStore();
                    switch (action)
                    {
                    case "lemons":
                        store.BuyMoreLemons(player1);
                        break;

                    case "sugar":
                        store.BuyMoreSugar(player1);
                        break;

                    case "ice":
                        store.BuyMoreIce(player1);
                        break;

                    case "cups":
                        store.BuyMoreCups(player1);
                        break;
                    }
                }
                User_Interface.Wait();
                customer1.GetNumberOfCustomers(weather1.conds);
                customer1.GetPercentOfSales(Convert.ToInt32(weather1.maxtempi));
                User_Interface.Wait();


                game.daysPlayed -= 1;
            }


            string        connectionString = "SERVER = desktop-ca2gle0; DATABASE = LemonadeStand; Integrated Security=true;";
            SqlConnection sqlconn          = new SqlConnection(connectionString);

            sqlconn.Open();
            HighScore_tb.InsertPlayerScore("Todd", "2.67", sqlconn);
            HighScore_tb.GetTopTenScores(sqlconn);
            sqlconn.Close();
            User_Interface.Exit();
        }