Advertisement
Guest User

fruit shop

a guest
Feb 27th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.61 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _08._Fruit_Shop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string fruit = Console.ReadLine();
  10.             string day = Console.ReadLine();
  11.             double quantity = double.Parse(Console.ReadLine());
  12.             double price = 0;
  13.             if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  14.             {
  15.                 if (fruit == "banana")
  16.                 {
  17.                     price = 2.50;
  18.                 }
  19.  
  20.                 else if (fruit == "apple")
  21.                 {
  22.                     price = 1.20;
  23.                 }
  24.  
  25.                 else if (fruit == "orange")
  26.                 {
  27.                     price = 0.85;
  28.                 }
  29.  
  30.                 else if (fruit == " grapefruit")
  31.                 {
  32.                     price = 1.45;
  33.                 }
  34.                 else if (fruit == "kiwi")
  35.                 {
  36.                     price = 2.70;
  37.  
  38.                 }
  39.                 else if (fruit == "pineapple")
  40.                 {
  41.                     price = 5.50;
  42.  
  43.                 }
  44.                 else if (fruit == "grapes")
  45.                 {
  46.                     price = 3.85;
  47.                 }
  48.  
  49.  
  50.  
  51.                 if (day == "Saturday" || day == "Sunday")
  52.                
  53.  
  54.                     else if (fruit == "banana")
  55.                     {
  56.                         price = 2.70;
  57.                     }
  58.  
  59.                     else if (fruit == "apple")
  60.                     {
  61.                         price = 1.25;
  62.                     }
  63.  
  64.                     else if (fruit == "orange")
  65.                     {
  66.                         price = 0.90;
  67.                     }
  68.  
  69.                     else if (fruit == "grapefruit")
  70.                     {
  71.                         price = 1.60;
  72.                     }
  73.                     else if (fruit == "kiwi")
  74.                     {
  75.                         price = 3.00;
  76.  
  77.                     }
  78.                     else if (fruit == "pineapple")
  79.                     {
  80.                         price = 5.60;
  81.  
  82.                     }
  83.                     else if (fruit == "grapes")
  84.                     {
  85.                         price = 4.20;
  86.                     }
  87.                 }
  88.                    
  89.                     {
  90.                         Console.WriteLine($"{price * quantity:F2}");
  91.                     }
  92.  
  93.                
  94.                 else
  95.                 {
  96.                     Console.WriteLine("error");
  97.                 }
  98.  
  99.                 }
  100.  
  101.  
  102.  
  103.             }
  104.  
  105.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement