Пример #1
0
        public static void Main(string[] args)
        {
            CandyShop candyShop = new CandyShop(300);

            candyShop.CreateSweets(CandyShop.CANDY);
            candyShop.CreateSweets(CandyShop.CANDY);
            candyShop.CreateSweets(CandyShop.LOLLIPOP);
            candyShop.CreateSweets(CandyShop.LOLLIPOP);
            candyShop.PrintInfo();
            // Should print out:
            // Invetory: 2 candies, 2 lollipops, Income: 0$, Sugar: 270gr
            candyShop.Sell(CandyShop.CANDY, 1);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 2 lollipops, Income: 20$, Sugar: 270gr"
            candyShop.Raise(5);
            candyShop.Sell(CandyShop.LOLLIPOP, 1);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 1 lollipops, Income: 35$, Sugar: 270gr"
            candyShop.BuySugar(300);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 1 lollipops, Income: 5$, Sugar: 570gr"
            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            // We run a Candy shop where we sell candies and lollipops
            // One lollipop's price is 10$
            // And it made from 5gr of sugar
            // One candie's price is 20$
            // And it made from 10gr of sugar
            // we can raise their prices with a given percentage

            // Create a CandyShop class
            // It can store sugar and money as income. The constructor should take the amount of sugar in gramms.
            // we can create lollipops and candies store them in the CandyShop's storage
            // If we create a candie or lollipop the CandyShop's sugar amount gets reduced by the amount needed to create the sweets
            // We can raise the prices of all candies and lollipops with a given percentage
            // We can sell candie or lollipop with a given number as amount
            // If we sell sweets the income will be increased by the price of the sweets and we delete it from the inventory
            // We can buy sugar with a given number as amount. The price of 1000gr sugar is 100$
            // If we buy sugar we can raise the CandyShop's amount of sugar and reduce the income by the price of it.
            // The CandyShop should print properties represented as string in this format:
            // "Inventory: 3 candies, 2 lollipops, Income: 100, Sugar: 400gr"
            CandyShop candyShop = new CandyShop(300);
            Lollipop  lollipop1 = new Lollipop(20);
            Candies   candy1    = new Candies(5);

            candyShop.CreateSweets(lollipop1);
            candyShop.CreateSweets(candy1);

            candyShop.CreateSweets(CandyShop.CANDY);
            candyShop.CreateSweets(CandyShop.CANDY);
            candyShop.CreateSweets(CandyShop.LOLLIPOP);
            candyShop.CreateSweets(CandyShop.LOLLIPOP);
            Console.WriteLine(candyShop);
            //candyShop.PrintInfo();
            // Should print out:
            // Invetory: 2 candies, 2 lollipops, Income: 0$, Sugar: 270gr
            candyShop.Sell(CandyShop.CANDY, 1);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 2 lollipops, Income: 20$, Sugar: 285gr"
            candyShop.Raise(5);
            candyShop.Sell(CandyShop.LOLLIPOP, 1);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 1 lollipops, Income: 35$, Sugar: 285gr"
            candyShop.BuySugar(300);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 1 lollipops, Income: 5$, Sugar: 315gr"
        }
Пример #3
0
        static void Main(string[] args)
        {
            var candyShop = new CandyShop(300);

            candyShop.CreateCandy();
            candyShop.CreateCandy();
            candyShop.CreateCandy();
            candyShop.CreateLollipop();
            candyShop.CreateLollipop();
            candyShop.PrintInfo();
            candyShop.SellCandy(2);
            candyShop.SellLollipop(1);
            candyShop.PrintInfo();

            Console.ReadLine();
        }
Пример #4
0
        static void Main(string[] args)
        {
            CandyShop candyShop = new CandyShop(300);

            candyShop.CreateSweetsCandy();
            candyShop.CreateSweetsCandy();
            candyShop.CreateSweetsLollipop();
            candyShop.CreateSweetsLollipop();
            candyShop.PrintInfo();
            //candyShop.Sell(CandyShop.CANDY, 1); - Not found solution yet
            candyShop.PrintInfo();
            candyShop.Raise(5);
            //candyShop.Sell(CandyShop.LOLLIPOP, 1); - Not found solution yet
            candyShop.PrintInfo();
            candyShop.BuySugar(300);
            candyShop.PrintInfo();
        }
Пример #5
0
        public static void Main(string[] args)
        {
            CandyShop candyShop = new CandyShop(300);

            candyShop.CreateSweets("Lollipop");
            candyShop.CreateSweets("Lollipop");
            candyShop.CreateSweets("Candy");
            candyShop.CreateSweets("Candy");
            candyShop.PrintInfo();
            candyShop.Sell("Candy", 1);
            candyShop.PrintInfo();
            candyShop.Raise(5);
            candyShop.Sell("Lollipop", 1);
            candyShop.PrintInfo();
            candyShop.BuySugar(300);
            candyShop.PrintInfo();
            Console.ReadLine();
        }
Пример #6
0
        public static void Main(string[] args)
        {
            // We run a Candy shop where we sell candies and lollipops
            // One lollipop's price is 10$
            // And it made from 5gr of sugar
            // One candie's price is 20$
            // And it made from 10gr of sugar
            // we can raise their prices with a given percentage

            // Create a CandyShop class
            // It can store sugar and money as income.
            // we can create lollipops and candies store them in the CandyShop's storage

            CandyShop candyShop = new CandyShop(300);

            candyShop.CreateSweets(CandyShop.CANDY);
            candyShop.CreateSweets(CandyShop.CANDY);
            candyShop.CreateSweets(CandyShop.LOLLIPOP);
            candyShop.CreateSweets(CandyShop.LOLLIPOP);
            candyShop.PrintInfo();
            // Should print out:
            // Invetory: 2 candies, 2 lollipops, Income: 0$, Sugar: 270gr
            candyShop.Sell(CandyShop.CANDY, 1);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 2 lollipops, Income: 20$, Sugar: 285gr"
            candyShop.Raise(5);
            candyShop.Sell(CandyShop.LOLLIPOP, 1);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 1 lollipops, Income: 35$, Sugar: 285gr"
            candyShop.BuySugar(300);
            candyShop.PrintInfo();
            // Should print out:
            // "Invetory: 1 candies, 1 lollipops, Income: 5$, Sugar: 315gr"
            Console.ReadKey();
        }