Advertisement
MladenKarachanov

Fruit Shop

Feb 23rd, 2025
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. string product = string(Console.ReadLine());
  2. string sity = string(Console.ReadLine());
  3. double quantity = double.Parse(Console.ReadLine());
  4.  
  5.  
  6. double price = 0;
  7. if (sity == "Sofia")
  8. {
  9.     if (product == coffee)
  10.     {
  11.         price = quantity * 0.50;
  12.     }
  13.     else if (product == water)
  14.     {
  15.         price = quantity * 0.80;
  16.     }
  17.     else if (product == beer)
  18.     {
  19.         price = quantity * 1.20;
  20.     }
  21.     else if (product == sweets)
  22.     {
  23.         price = quantity * 1.45;
  24.     }
  25.     else if (product == peanuts)
  26.     {
  27.         price = quantity * 1.60;
  28.     }
  29. }
  30.  
  31. else if ("Plovdiv")
  32. {
  33.     if (product == coffee)
  34.     {
  35.         price = quantity * 0.40;
  36.     }
  37.     else if (product == water)
  38.     {
  39.         price = quantity * 0.70;
  40.     }
  41.     else if (product == beer)
  42.     {
  43.         price = quantity * 1.15;
  44.     }
  45.     else if (product == sweets)
  46.     {
  47.         price = quantity * 1.30;
  48.     }
  49.     else if (product == peanuts)
  50.     {
  51.         price = quantity * 1.50;
  52.     }
  53. }
  54.  
  55. else if ("Varna")
  56. {
  57.     if (product == coffee)
  58.     {
  59.         price = quantity * 0.45;
  60.     }
  61.     else if (product == water)
  62.     {
  63.         price = quantity * 0.70;
  64.     }
  65.     else if (product == beer)
  66.     {
  67.         price = quantity * 1.10;
  68.     }
  69.     else if (product == sweets)
  70.     {
  71.         price = quantity * 1.35;
  72.     }
  73.     else if (product == peanuts)
  74.     {
  75.         price = quantity * 1.55;
  76.     }
  77.  
  78.     Console.WriteLine(price)
  79.  
  80.  
  81.        
  82.  
  83.  
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement