Advertisement
BdW44222

Untitled

May 4th, 2020
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.55 KB | None | 0 0
  1. using System;
  2.  
  3. namespace fruitShop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //1.input :
  10.             //fruit
  11.             //weekDay
  12.             //double quantity
  13.             string fruit = Console.ReadLine();
  14.             string dayOfTheWeek = Console.ReadLine();
  15.             double quantity = double.Parse(Console.ReadLine());
  16.             double price = 0;
  17.  
  18.             if(dayOfTheWeek.Equals("Monday") || dayOfTheWeek.Equals("Tuesday") || dayOfTheWeek.Equals("Wednesday") || dayOfTheWeek.Equals("Thursday") || dayOfTheWeek.Equals("Friday"))
  19.             {
  20.                 switch (fruit)
  21.                 {
  22.                     case "banana":
  23.                         double priceF = quantity *(price + 2.50);
  24.                         Console.WriteLine($"{priceF:F2}");
  25.                         break;
  26.  
  27.                     case "apple":
  28.                         double priceFr = quantity * (price + 1.20);
  29.                         Console.WriteLine($"{priceFr:F2}");
  30.                         break;
  31.  
  32.                     case "orange":
  33.                         double priceFru = quantity * (price + 0.85);
  34.                         Console.WriteLine($"{priceFru:F2}");
  35.                         break;
  36.  
  37.                     case "grapefruit":
  38.                         double priceFrui = quantity * (price + 1.45);
  39.                         Console.WriteLine($"{priceFrui:F2}");
  40.                         break;
  41.  
  42.                     case "kiwi":
  43.                         double priceFruit = quantity * (price + 2.70);
  44.                         Console.WriteLine($"{priceFruit:F2}");
  45.                         break;
  46.  
  47.                     case "pineapple":
  48.                         double priceFruits = quantity * (price + 5.50);
  49.                         Console.WriteLine($"{priceFruits:F2}");
  50.                         break;
  51.  
  52.                     case "grapes":
  53.                         double priceFruitss = quantity * (price + 3.85);
  54.                         Console.WriteLine($"{priceFruitss:F2}");
  55.                         break;
  56.  
  57.                 }
  58.             }
  59.             else if (dayOfTheWeek.Equals("Saturday") || dayOfTheWeek.Equals("Sunday"))
  60.             {
  61.                 switch (fruit)
  62.                 {
  63.                     case "banana":
  64.                         double pr = quantity * (price + 2.70);
  65.                         Console.WriteLine($"{pr:F2}");
  66.                         break;
  67.  
  68.                     case "apple":
  69.                         double pri = quantity * (price + 1.25);
  70.                         Console.WriteLine($"{pri:F2}");
  71.                         break;
  72.  
  73.                     case "orange":
  74.                         double pric = quantity * (price + 0.90);
  75.                         Console.WriteLine($"{pric:F2}");
  76.                         break;
  77.  
  78.                     case "grapefruit":
  79.                         double pricee = quantity * (price + 1.60);
  80.                         Console.WriteLine($"{pricee:F2}");
  81.                         break;
  82.  
  83.                     case "kiwi":
  84.                         double priceeee = quantity * (price + 3.00);
  85.                         Console.WriteLine($"{priceeee:F2}");
  86.                         break;
  87.  
  88.                     case "pineapple":
  89.                         double priceef = quantity * (price + 5.60);
  90.                         Console.WriteLine($"{priceef:F2}");
  91.                         break;
  92.  
  93.                     case "grapes":
  94.                         double priceeff = quantity * (price + 4.20);
  95.                         Console.WriteLine($"{priceeff:F2}");
  96.                         break;    
  97.                 }
  98.             }
  99.             else
  100.             {
  101.                 Console.WriteLine("error");
  102.             }
  103.  
  104.             //2.Пресмята цена според таблицата
  105.             // плод  banana  apple  orange grapefruit  kiwi   pineapple  grapes
  106.             //цена   2.50    1.20   0.85      1.45     2.70    5.50      3.85
  107.             //Събота и неделя магазинът работи на по - високи цени:
  108.             //плод  banana   apple  orange  grapefruit  kiwi   pineapple  grapes
  109.             //цена   2.70    1.25   0.90       1.60     3.00     5.60      4.20
  110.  
  111.             //3.Резултатът да се отпечата закръглен с 2 цифри след десетичната точка. При
  112.             //невалиден ден от седмицата или невалидно име на плод да се отпечата error!
  113.  
  114.  
  115.  
  116.  
  117.         }
  118.     }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement