示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hey!");
            Console.WriteLine("How many lemonade stands would you like to open?");

            int numberOfLemonadeStands     = int.Parse(Console.ReadLine());
            List <LemonadeStand> locations = new List <LemonadeStand>();

            for (int i = 0; i < numberOfLemonadeStands; i++)
            {
                LemonadeStand lemonadeStand = new LemonadeStand();

                Console.WriteLine("What is the name of location " + (i + 1) + "?");
                lemonadeStand.Name = Console.ReadLine();

                Console.WriteLine("How many cups will you sell?");
                lemonadeStand.NumberOfCups = Int32.Parse(Console.ReadLine());

                Console.WriteLine("How much will you sell each cup for?");
                lemonadeStand.PricePerCup = decimal.Parse(Console.ReadLine());


                Console.WriteLine("How much will each cup cost to make?");
                lemonadeStand.CostPerCup = decimal.Parse(Console.ReadLine());

                Console.WriteLine("You'll be opening a stand called " + lemonadeStand.Name + ".");
                Console.WriteLine("If you sell all " + lemonadeStand.NumberOfCups + "cups");
                Console.WriteLine("Your total revenue will be $" + lemonadeStand.GetTotalRevenue() + ".");
                Console.WriteLine("Your total expnses will be $" + lemonadeStand.GetTotalExpenses() + ".");
                Console.WriteLine("Your total profit will be $" + lemonadeStand.GetTotalProfit() + ".");
            }
            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("How many stands do you want to open?");
            int numberOfStands = int.Parse(Console.ReadLine());

            for (int i = 1; i <= numberOfStands; i++)
            {
                LemonadeStand newStand = new LemonadeStand();

                Console.WriteLine("What is the name of location " + i + "?");
                newStand.Name = Console.ReadLine();

                Console.WriteLine("How many cups will you sell in this location ");
                newStand.NumberOfCups = int.Parse(Console.ReadLine());

                Console.WriteLine("What is the price in this location");
                newStand.PricePerCup = decimal.Parse(Console.ReadLine());

                Console.WriteLine("What is the cost in this location");

                newStand.CostPerCup = decimal.Parse(Console.ReadLine());

                Console.WriteLine("This stand's total revenue will be "
                                  + newStand.GetTotalRevenue());
                Console.WriteLine("This stand's total expense will be "
                                  + newStand.GetTotalExpenses());

                Console.WriteLine("This stand's total profit will be "
                                  + newStand.GetTotalProfit());
            }
            for (int i = 1; i <= numberOfStands; i++)
            {
                LemonadeStandCorporation totalsOfStands = new LemonadeStandCorporation();
            }
            Console.WriteLine("Total revenue");
            LemonadeStandCorporation totals = new LemonadeStandCorporation();

            Console.WriteLine("Total revenue is " + totals.GetTotalRevenueOfStands());
            Console.WriteLine("Total profit is " + totals.GetTotalProfitOfStands());
            Console.WriteLine("Total expense is " + totals.GetTotalExpensesOfStands());

            Console.ReadLine();
        }