Advertisement
Guest User

Untitled

a guest
Jun 9th, 2016
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.45 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FruitShop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             var fruit = Console.ReadLine();
  11.             var day = Console.ReadLine();
  12.             double quantity = double.Parse(Console.ReadLine());
  13.             double price;
  14.  
  15.  
  16.             if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Tuesday" || day == "Friday")
  17.             {
  18.                 if (fruit == "banana")
  19.                 { price = 2.50; Console.WriteLine("{0:0.##}", quantity * price); }
  20.  
  21.                 else if (fruit == "apple")
  22.                 { price = 1.20; Console.WriteLine("{0:0.##}", quantity * price); }
  23.  
  24.                 else if (fruit == "orange")
  25.                 { price = 0.85; Console.WriteLine("{0:0.##}", quantity * price); }
  26.  
  27.                 else if (fruit == "grapefruit")
  28.                 { price = 1.45; Console.WriteLine("{0:0.##}", quantity * price); }
  29.  
  30.                 else if (fruit == "kiwi")
  31.                 { price = 2.70; Console.WriteLine("{0:0.##}", quantity * price); }
  32.  
  33.                 else if (fruit == "pineapple")
  34.                 { price = 5.50; Console.WriteLine("{0:0.##}", quantity * price); }
  35.  
  36.                 else if (fruit == "grapes")
  37.                 { price = 3.85; Console.WriteLine("{0:0.##}", quantity * price); }
  38.  
  39.                 else { Console.WriteLine("error"); }
  40.             }
  41.  
  42.  
  43.             else if (day == "Saturday" || day == "Sunday")
  44.             {
  45.                 if (fruit == "banana")
  46.                 { price = 2.70; Console.WriteLine("{0:0.##}", quantity * price); }
  47.  
  48.                 else if (fruit == "apple")
  49.                 { price = 1.25; Console.WriteLine("{0:0.##}", quantity * price); }
  50.  
  51.                 else if (fruit == "orange")
  52.                 { price = 0.90; Console.WriteLine("{0:0.##}", quantity * price); }
  53.  
  54.                 else if (fruit == "grapefruit")
  55.                 { price = 1.60; Console.WriteLine("{0:0.##}", quantity * price); }
  56.  
  57.                 else if (fruit == "kiwi")
  58.                 { price = 3.00; Console.WriteLine("{0:0.##}", quantity * price); }
  59.  
  60.                 else if (fruit == "pineapple")
  61.                 { price = 5.60; Console.WriteLine("{0:0.##}", quantity * price); }
  62.  
  63.                 else if (fruit == "grapes")
  64.                 { price = 4.20; Console.WriteLine("{0:0.##}", quantity * price); }
  65.  
  66.                 else { Console.WriteLine("error"); }
  67.             }
  68.  
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement