コード例 #1
0
ファイル: Player.cs プロジェクト: jtpete/LemonadeStand
        private void AddSupplies(string item, int qty)
        {
            switch (item)
            {
            case "Lemon":
                for (int i = 0; i < qty; i++)
                {
                    mySupplies.myLemons.Add(mySupplier.GetNewLemon());
                    wallet -= mySupplier.GetPrice("Lemon");
                }
                break;

            case "Sugar":
                for (int i = 0; i < qty; i++)
                {
                    mySupplies.mySugar.Add(mySupplier.GetNewSugar());
                    wallet -= mySupplier.GetPrice("Sugar");
                }
                break;

            case "Ice":
                for (int i = 0; i < qty; i++)
                {
                    mySupplies.myIce.Add(mySupplier.GetNewIce());
                    wallet -= mySupplier.GetPrice("Ice");
                }
                break;
            }
        }
コード例 #2
0
 public static void PurchaseSuppliesMenu(string name, double wallet, Supplies suppliesList, Supplier vendor, string message)
 {
     Console.Clear();
     Console.WriteLine($"╔═══════════════════════════════════════════════╗");
     Console.WriteLine($"║                 PURCHASE SUPPLIES             ║");
     Console.WriteLine($"║                                               ║");
     Console.WriteLine("║   Manager: {0,-12}    ${1,-10}        ║", name, wallet.ToString("0.00"));
     Console.WriteLine($"║                                               ║");
     Console.WriteLine($"║     Current Supplies:                         ║");
     Console.WriteLine("║     Lemons        : {0,-5}                     ║", suppliesList.MyLemons.Count);
     Console.WriteLine("║     Cups of Sugar : {0,-5}                     ║", suppliesList.MySugar.Count);
     Console.WriteLine("║     Ice Cubes     : {0,-5}                     ║", suppliesList.MyIce.Count);
     Console.WriteLine($"╠═══════════════════════════════════════════════╣");
     Console.WriteLine($"║                                Current Price  ║");
     Console.WriteLine("║     1.  Add Lemons             ${0,-5}         ║", vendor.GetPrice("Lemon").ToString("0.00"));
     Console.WriteLine("║     2.  Add Cups of Sugar      ${0,-5}         ║", vendor.GetPrice("Sugar").ToString("0.00"));
     Console.WriteLine("║     3.  Add Ice Cubes          ${0,-5}         ║", vendor.GetPrice("Ice").ToString("0.00"));
     Console.WriteLine("║     4.  Done                                  ║");
     Console.WriteLine($"╠═══════════════════════════════════════════════╝");
     Console.WriteLine($"║   {message}                                   ");
     Console.WriteLine($"╚═══════════════════════════════════════════════");
 }