SHARE
TWEET

Untitled

a guest Mar 26th, 2017 323 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Fruit_Shop
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             var fruit = Console.ReadLine().ToLower();
  10.             var day = Console.ReadLine().ToLower();
  11.             var quantity = double.Parse(Console.ReadLine());
  12.             var price = -1.0;
  13.  
  14.             if ((day == "monday") ||
  15.                 (day == "tuesday") ||
  16.                 (day == "wednesday") ||
  17.                 (day == "thursday") ||
  18.                 (day == "friday"))
  19.             {
  20.                 if (fruit == "banana") { price = 2.50; }
  21.                 else if (fruit == "apple") { price = 1.20; }
  22.                 else if (fruit == "orange") { price = 0.85; }
  23.                 else if (fruit == "grapefruit") { price = 1.45; }
  24.                 else if (fruit == "kiwi") { price = 2.70; }
  25.                 else if (fruit == "pineapple") { price = 5.50; }
  26.                 else if (fruit == "grapes") { price = 3.85; }
  27.             }
  28.  
  29.             else if ((day == "saturday") || (day == "sunday"))
  30.             {
  31.                 if (fruit == "banana") { price = 2.70; }
  32.                 else if (fruit == "apple") { price = 1.25; }
  33.                 else if (fruit == "orange") { price = 0.90; }
  34.                 else if (fruit == "grapefruit") { price = 1.60; }
  35.                 else if (fruit == "kiwi") { price = 3.00; }
  36.                 else if (fruit == "pineapple") { price = 5.60; }
  37.                 else if (fruit == "grapes") { price = 4.20; }
  38.             }
  39.  
  40.             if (price > 0)
  41.             {
  42.                 Console.WriteLine("{0:f2}", price * quantity);
  43.             }
  44.             else
  45.             {
  46.                 Console.WriteLine("error");
  47.             }
  48.         }
  49.     }
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top