Advertisement
fbinnzhivko

Untitled

Sep 20th, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.97 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_if_
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string fruit = Console.ReadLine().ToLower();
  14.             string dayOfTheWeek = Console.ReadLine().ToLower();
  15.             double num = double.Parse(Console.ReadLine());
  16.             double result = -1;
  17.             if (dayOfTheWeek == "monday" ||
  18.                 dayOfTheWeek == "tuesday" ||
  19.                 dayOfTheWeek == "wednesday" ||
  20.                 dayOfTheWeek == "thursday" ||
  21.                 dayOfTheWeek == "friday")
  22.             {
  23.                 if (fruit == "banana")
  24.                 {
  25.                     result = num * 2.5d;
  26.                 }
  27.                 else if (fruit == "apple")
  28.                 {
  29.                     result = num * 1.2d;
  30.                 }
  31.                 else if (fruit == "orange")
  32.                 {
  33.                     result = num * 0.85d;
  34.                 }
  35.                 else if (fruit == "grapefruit")
  36.                 {
  37.                     result = num * 1.45d;
  38.                 }
  39.                 else if (fruit == "kiwi")
  40.                 {
  41.                     result = num * 2.7d;
  42.                 }
  43.                 else if (fruit == "pineapple")
  44.                 {
  45.                     result = num * 5.5d;
  46.                 }
  47.                 else if (fruit == "grapes")
  48.                 {
  49.                     result = num * 3.85d;
  50.                 }
  51.                 else
  52.                 {
  53.                     Console.WriteLine("error");
  54.                 }
  55.             }
  56.             else if (dayOfTheWeek == "sunday" ||
  57.                 dayOfTheWeek == "saturday")
  58.             {
  59.                 if (fruit == "banana")
  60.                 {
  61.                     result = num * 2.7d;
  62.                 }
  63.                 else if (fruit == "apple")
  64.                 {
  65.                     result = num * 1.25d;
  66.                 }
  67.                 else if (fruit == "orange")
  68.                 {
  69.                     result = num * 0.9d;
  70.                 }
  71.                 else if (fruit == "grapefruit")
  72.                 {
  73.                     result = num * 1.6d;
  74.                 }
  75.                 else if (fruit == "kiwi")
  76.                 {
  77.                     result = num * 3.0d;
  78.                 }
  79.                 else if (fruit == "pineapple")
  80.                 {
  81.                     result = num * 5.6d;
  82.                 }
  83.                 else if (fruit == "grapes")
  84.                 {
  85.                     result = num * 4.2d;
  86.  
  87.                 }
  88.                 else
  89.                 {
  90.                     Console.WriteLine("error");
  91.                 }
  92.             }
  93.             else
  94.             {
  95.                 Console.WriteLine("error");
  96.             }
  97.  
  98.             if (result >= 0)
  99.             {
  100.                 Console.WriteLine("{0:F2}", result);
  101.             }
  102.            
  103.         }
  104.     }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement