Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.42 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().ToLower();
  11.             var quantity = double.Parse(Console.ReadLine());
  12.             var price = 0.0;
  13.  
  14.             if (day == "saturday" || day == "sunday")
  15.             {
  16.                 if (fruit == "banana")
  17.                 {
  18.                   price = 2.70;
  19.                   Console.WriteLine("{0:f2}", price * quantity);
  20.                 }
  21.                   else if (fruit == "apple")
  22.               {
  23.                 price = 1.25;  
  24.                 Console.WriteLine("{0:f2}", price * quantity);
  25.               }
  26.               else if (fruit == "orange") {
  27.                 price = 0.90;
  28.                  Console.WriteLine("{0:f2}", price * quantity);
  29.               }
  30.               else if (fruit == "grapefruit")
  31.               {
  32.                 price = 1.60;
  33.                  Console.WriteLine("{0:f2}", price * quantity);
  34.               }
  35.                 else if (fruit == "kiwi")
  36.                 {
  37.                   price = 3.00;
  38.                  Console.WriteLine("{0:f2}", price * quantity);
  39.                 }
  40.                   else if (fruit == "pineapple")
  41.                   {
  42.                     price = 5.60;
  43.                 Console.WriteLine("{0:f2}", price * quantity);
  44.                   }
  45.                     else if (fruit == "grapes")
  46.                     {
  47.                       price = 4.20;
  48.                 Console.WriteLine("{0:f2}", price * quantity);
  49.                     }
  50.               else
  51.               {
  52.                 Console.WriteLine("error");
  53.               }
  54.             }
  55.  
  56.             else if (day == "monday" || day == "tuesday" || day == "wednesday" || day == "thursday" || day == "friday")
  57.             {
  58.                 if (fruit == "banana")
  59.                 {
  60.                  price = 2.50;
  61.                  Console.WriteLine("{0:f2}", price * quantity);
  62.                 }
  63.                 else if (fruit == "apple")
  64.                   {
  65.                   price = 1.20;
  66.                   Console.WriteLine("{0:f2}", price * quantity);
  67.                   }
  68.                 else if (fruit == "orange")
  69.                 {
  70.                  price = 0.85;
  71.                  Console.WriteLine("{0:f2}", price * quantity);
  72.                 }
  73.                  else if (fruit == "grapefruit")
  74.                  {
  75.                    price = 1.45;
  76.                    Console.WriteLine("{0:f2}", price * quantity);
  77.                  }
  78.                 else if (fruit == "kiwi")
  79.                 {
  80.                   price = 2.70;
  81.                   Console.WriteLine("{0:f2}", price * quantity);
  82.                 }
  83.                 else if (fruit == "pineapple")
  84.                 {
  85.                   price = 5.50;
  86.                   Console.WriteLine("{0:f2}", price * quantity);
  87.                 }
  88.                 else if (fruit == "grapes")
  89.                 {
  90.                   price = 3.85;
  91.                    Console.WriteLine("{0:f2}", price * quantity);
  92.                 }
  93.                else
  94.                {
  95.                  Console.WriteLine("error");
  96.                }
  97.             }                                      
  98.             else
  99.             {
  100.                 Console.WriteLine("error");            
  101.             }
  102.  
  103.             Console.ReadLine();
  104.         }
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement