anizko

06. Fruit Shop

Apr 1st, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.44 KB | None | 0 0
  1. using System;
  2.  
  3. namespace 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 Qantity = double.Parse(Console.ReadLine());
  12.             double price = 0;
  13.  
  14.             if (Day == "Monday" || Day == "Tuesday" || Day == "Wednesday" ||
  15.                             Day == "Thursday" || Day == "Friday")
  16.             {
  17.                 if (Fruit == "banana")
  18.                 {
  19.                     price = Qantity * 2.50;
  20.                     Console.WriteLine($"{price:f2}");
  21.                 }
  22.  
  23.                 else if (Fruit == "apple")
  24.                 {
  25.                     price = Qantity * 1.20;
  26.                     Console.WriteLine($"{price:f2}");
  27.  
  28.                 }
  29.                 else if (Fruit == "orange")
  30.                 {
  31.                     price = Qantity * 0.85;
  32.                     Console.WriteLine($"{price:f2}");
  33.  
  34.                 }
  35.                 else if (Fruit == "grapefruit")
  36.                 {
  37.                     price = Qantity * 1.45;
  38.                     Console.WriteLine($"{price:f2}");
  39.  
  40.                 }
  41.                 else if (Fruit == "kiwi")
  42.                 {
  43.                     price = Qantity * 2.70;
  44.                     Console.WriteLine($"{price:f2}");
  45.  
  46.                 }
  47.                 else if (Fruit == "pineapple")
  48.                 {
  49.                     price = Qantity * 5.50;
  50.                     Console.WriteLine($"{price:f2}");
  51.                 }
  52.  
  53.                 else if (Fruit == "grapes")
  54.                 {
  55.                     price = Qantity * 3.85;
  56.                     Console.WriteLine($"{price:f2}");
  57.  
  58.                 }
  59.                 else
  60.                 {
  61.                     Console.WriteLine("error");
  62.  
  63.                 }
  64.  
  65.  
  66.  
  67.             }
  68.             else if (Day == "Saturday" || Day == "Sunday")
  69.             {
  70.  
  71.                 if (Fruit == "banana")
  72.                 {
  73.                     price = Qantity * 2.70;
  74.                     Console.WriteLine($"{price:f2}");
  75.                 }
  76.  
  77.  
  78.                 else if (Fruit == "apple")
  79.                 {
  80.                     price = Qantity * 1.25;
  81.                     Console.WriteLine($"{price:f2}");
  82.                 }
  83.  
  84.                 else if (Fruit == "orange")
  85.                 {
  86.                     price = Qantity * 0.90;
  87.                     Console.WriteLine($"{price:f2}");
  88.                 }
  89.  
  90.                 else if (Fruit == "grapefruit")
  91.                 {
  92.                     price = Qantity * 1.60;
  93.                     Console.WriteLine($"{price:f2}");
  94.                 }
  95.  
  96.                 else if (Fruit == "kiwi")
  97.                 {
  98.                     price = Qantity * 3.00;
  99.                     Console.WriteLine($"{price:f2}");
  100.                 }
  101.  
  102.                 else if (Fruit == "pineapple")
  103.                 {
  104.                     price = Qantity * 5.60;
  105.                     Console.WriteLine($"{price:f2}");
  106.                 }
  107.  
  108.                 else if (Fruit == "grapes")
  109.                 {
  110.                     price = Qantity * 4.20;
  111.                     Console.WriteLine($"{price:f2}");
  112.                 }
  113.  
  114.  
  115.                 else
  116.                 {
  117.                     Console.WriteLine("error");
  118.  
  119.                 }
  120.             }
  121. else
  122.  {
  123.                 Console.WriteLine("error");
  124.             }
  125.  
  126.        
  127.            
  128.  
  129.  
  130.  
  131.         }
  132.     }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment