Advertisement
Guest User

Untitled

a guest
Nov 27th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Fruit_Shop
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var fruit = Console.ReadLine().ToLower();
  14.             var day = Console.ReadLine().ToLower();
  15.             var quantity = double.Parse(Console.ReadLine());
  16.             var price = -1.0;
  17.  
  18.             if ((day == "monday") ||
  19.                 (day == "tuesday") ||
  20.                 (day == "wednesday") ||
  21.                 (day == "thursday") ||
  22.                 (day == "friday"))
  23.             {
  24.                 if (fruit == "banana") { price = 2.50; }
  25.                 else if (fruit == "apple") { price = 1.20; }
  26.                 else if (fruit == "orange") { price = 0.85; }
  27.                 else if (fruit == "grapefruit") { price = 1.45; }
  28.                 else if (fruit == "kiwi") { price = 2.70; }
  29.                 else if (fruit == "pineapple") { price = 5.50; }
  30.                 else if (fruit == "grapes") { price = 3.85; }
  31.             }
  32.  
  33.             else if ((day == "saturday") || (day == "sunday"))
  34.             {
  35.                 if (fruit == "banana") { price = 2.70; }
  36.                 else if (fruit == "apple") { price = 1.25; }
  37.                 else if (fruit == "orange") { price = 0.90; }
  38.                 else if (fruit == "grapefruit") { price = 1.60; }
  39.                 else if (fruit == "kiwi") { price = 3.00; }
  40.                 else if (fruit == "pineapple") { price = 5.60; }
  41.                 else if (fruit == "grapes") { price = 4.20; }
  42.             }
  43.  
  44.             if (price > 0)
  45.             {
  46.                 Console.WriteLine("{0:f2}", price * quantity);
  47.             }
  48.             else
  49.             {
  50.                 Console.WriteLine("error");
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement