daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.             string fruit = Console.ReadLine().ToLower();
  14.             string day = Console.ReadLine().ToLower();
  15.             double quantity = double.Parse(Console.ReadLine());
  16.             double price = 0;
  17.             bool error = false;
  18.  
  19.             if (day == "saturday" || day == "sunday")
  20.             {
  21.                 if (fruit == "banana")
  22.                 {
  23.                     price = 2.70;
  24.                 }
  25.  
  26.                 else if (fruit == "apple")
  27.                 {
  28.                     price = 1.25;
  29.                 }
  30.                 else if (fruit == "orange")
  31.                 {
  32.                     price = 0.90;
  33.                 }
  34.                 else if (fruit == "grapefruit")
  35.                 {
  36.                     price = 1.60;
  37.                 }
  38.  
  39.                 else if (fruit == "kiwi")
  40.                 {
  41.                     price = 3.00;
  42.                 }
  43.  
  44.                 else if (fruit == "pineapple")
  45.                 {
  46.                     price = 5.60;
  47.                 }
  48.  
  49.                 else if (fruit == "grapes")
  50.                 {
  51.                     price = 4.20;
  52.                 }
  53.                 else
  54.                 {
  55.                     error = true;
  56.                 }
  57.             }
  58.  
  59.             else if (day == "monday" || day == "tuesday" || day == "wednesday" || day == "thirsday" || day == "friday")
  60.             {
  61.                 if (fruit == "banana")
  62.                 {
  63.                     price = 2.50;
  64.                 }
  65.                 else if (fruit == "apple")
  66.                 {
  67.                     price = 1.20;
  68.                 }
  69.  
  70.                 else if (fruit == "orange")
  71.                 {
  72.                     price = 0.85;
  73.                 }
  74.  
  75.                 else if (fruit == "grapefruit")
  76.                 {
  77.                     price = 1.45;
  78.                 }
  79.  
  80.                 else if (fruit == "kiwi")
  81.                 {
  82.                     price = 2.70;
  83.                 }
  84.                 else if (fruit == "pineapple")
  85.                 {
  86.                     price = 5.50;
  87.                 }
  88.                 else if (fruit == "grapes")
  89.                 {
  90.                     price = 3.85;
  91.                 }
  92.                 else
  93.                 {
  94.                     error = true;
  95.                 }
  96.  
  97.             }
  98.             if (error)
  99.  
  100.             {
  101.                 Console.WriteLine("error");
  102.             }
  103.             else
  104.             {
  105.                 double totalPrice = price * quantity;
  106.                 Console.WriteLine(Math.Round(totalPrice, 2));
  107.             }
  108.                        
  109.         }
  110.  
  111.     }
  112.    
  113. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top