Guest User

Untitled

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