Anzzhhela98

dd

May 20th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.65 KB | None | 0 0
  1. using System;
  2.  
  3. namespace storeForFruits
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string fruit = Console.ReadLine();
  10.             string day = Console.ReadLine();
  11.             double quantity = double.Parse(Console.ReadLine());
  12.             double price = 0.00;
  13.            
  14.             if (day == "monday" && day == "tuesday" && day == "wednesday" && day == "thursday" && day == "friday")
  15.             {
  16.                 if (fruit == "banana")
  17.                 {
  18.                     price = 2.50;
  19.                 }
  20.                 else if (fruit == "apple")
  21.                 {
  22.                     price = 1.20;
  23.                 }
  24.                 else if (fruit == "orange")
  25.                 {
  26.                     price = 0.85;
  27.                 }
  28.                 else if (fruit == "grapefruit")
  29.                 {
  30.                     price = 1.45;
  31.                 }
  32.                 else if (fruit == "kiwi")
  33.                 {
  34.                     price = 2.70;
  35.                 }
  36.                 else if (fruit == "pineapple")
  37.                 {
  38.                     price = 5.50;
  39.                 }
  40.                 else if (fruit == "grapes")
  41.                 {
  42.                     price = 3.85;
  43.                 }
  44.                 double totalPrice = price * quantity;
  45.                 Console.WriteLine($"{totalPrice:f2}");
  46.             }
  47.             else if (day == "saturday" && day == "sunday")
  48.             {
  49.                 if (fruit == "banana")
  50.                 {
  51.                     price = 2.70;
  52.                 }
  53.                 else if (fruit == "apple")
  54.                 {
  55.                     price = 1.25;
  56.                 }
  57.                 else if (fruit == "orange")
  58.                 {
  59.                     price = 0.90;
  60.                 }
  61.                 else if (fruit == "grapefruit")
  62.                 {
  63.                     price = 1.60;
  64.                 }
  65.                 else if (fruit == "kiwi")
  66.                 {
  67.                     price = 3.00;
  68.                 }
  69.                 else if (fruit == "pineapple")
  70.                 {
  71.                     price = 5.60;
  72.                 }
  73.                 else if (fruit == "grapes")
  74.                 {
  75.                     price = 4.20;
  76.                 }
  77.                 double totalPrice = price * quantity;
  78.                 Console.WriteLine($"{totalPrice:f2}");
  79.  
  80.             }
  81.             if (fruit != "banana" && fruit == "apple"&& fruit == "orange"&& fruit == "grapes"&& fruit == "pineapple"&& fruit == "kiwi"&&fruit == "grapefruit")
  82.             {
  83.                 Console.WriteLine("errorr");
  84.             }
  85.  
  86.             }
  87.         }
  88.     }
Advertisement
Add Comment
Please, Sign In to add comment