Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             ShoppingCart myCart = new ShoppingCart();
  4.             while (true)
  5.             {
  6.                 Console.Write("Введите название предмета: ");
  7.                 string itemName = Console.ReadLine();
  8.                 double itemPrice = DoubleInput("Введите цену: ");
  9.                 int itemQuantity = IntInput("Введите количество: ");
  10.  
  11.                 myCart.AddToCart(itemName, itemPrice, itemQuantity);
  12.                 Console.WriteLine(myCart.ToString());
  13.                 Console.Write("Хотите добавить еще предмет? (yes/no) ... ");
  14.                 string input = Console.ReadLine();
  15.                 while (input != "yes" && input != "no" && input != "y" && input != "n")
  16.                 {
  17.                     Console.Write("Введите yes или no: ");
  18.                     input = Console.ReadLine();
  19.                 }
  20.  
  21.                 if (input == "yes" || input == "y")
  22.                 {
  23.                     continue;
  24.                 }
  25.                 else
  26.                 {
  27.                     Console.WriteLine("Пожалуйста, оплатите\t {0:N} рублей", myCart.TotalPrice);
  28.                     Console.ReadLine();
  29.                     break;
  30.                 }
  31.  
  32.  
  33.             }
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement