Advertisement
MladenKarachanov

Компилационна грешка Fruit Shop

Feb 23rd, 2025
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 KB | None | 0 0
  1. string day = Console.ReadLine();
  2. string frut = Console.ReadLine();
  3. double quantity = double.Parse(Console.ReadLine());
  4.  
  5. double price = 0;
  6. if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  7. {
  8.     if (frut == "banana")
  9.     {
  10.         price = quantity * 2.50;
  11.     }
  12.     else if (frut == "apple")
  13.     {
  14.         price = quantity * 1.20;
  15.     }
  16.     else if (frut == "orange")
  17.     {
  18.         price = quantity * 0.85;
  19.     }
  20.     else if (frut == "grapefruit")
  21.     {
  22.         price = quantity * 1.45;
  23.     }
  24.     else if (frut == "kiwi")
  25.     {
  26.         price = quantity * 2.70;
  27.     }
  28.     else if (frut == "pineapple")
  29.     {
  30.         price = quantity * 5.50;
  31.     }
  32.     else if (frut == "grapes")
  33.     {
  34.         price = quantity * 3.85;
  35.     }
  36. }
  37. else if (day == "Saturday" || day = "Sunday")
  38. {
  39.     if (frut == "banana")
  40.     {
  41.         price = quantity * 2.70;
  42.     }
  43.     else if (frut == "apple")
  44.     {
  45.         price = quantity * 1.25;
  46.     }
  47.     else if (frut == "orange")
  48.     {
  49.         price = quantity * 0.90;
  50.     }
  51.     else if (frut == "grapefruit")
  52.     {
  53.         price = quantity * 1.60;
  54.     }
  55.     else if (frut == "kiwi")
  56.     {
  57.         price = quantity * 3.0;
  58.     }
  59.     else if (frut == "pineapple")
  60.     {
  61.         price = quantity * 5.60;
  62.     }
  63.     else if (frut == "grapes")
  64.     {
  65.         price = quantity * 4.20;
  66.     }
  67. }
  68.     Console.WriteLine(price);
  69. }
  70.     else
  71.  
  72. {
  73.     Console.WriteLine(error);
  74. }
  75.    
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement