Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Shop
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- //Add, Sell, Update, Calculate, Print
- Shop shop = new Shop();
- while(input.ToLower() != "close")
- {
- string[] splittedInput = input.Split(" ");
- string command = splittedInput[0];
- switch (command)
- {
- case "Add":
- string addCode = splittedInput[1];
- string name = splittedInput[2];
- double price = double.Parse(splittedInput[3]);
- double addQuantity = double.Parse(splittedInput[4]);
- shop.Add(addCode, name, price, addQuantity);
- break;
- case "Sell":
- //code
- string sellCode = splittedInput[1];
- //quantity
- double sellQuantity = double.Parse(splittedInput[2]);
- shop.Sell(sellCode, sellQuantity);
- break;
- case "Update":
- //code
- string code = splittedInput[1];
- //quantity
- double quantity = double.Parse(splittedInput[2]);
- shop.Update(code, quantity);
- break;
- case "Calculate":
- Console.WriteLine("Total price: " + shop.Calculate());
- break;
- case "Print":
- shop.Print();
- break;
- }
- input = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment