Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FruitShop
- {
- class FruitShop
- {
- static void Main(string[] args)
- {
- string Fruit = Console.ReadLine().ToLower();
- string dayOfWeek = Console.ReadLine().ToLower();
- double quаntity = double.Parse(Console.ReadLine());
- string monday = "Monday";
- string tuesday = "Tuesday";
- string wednesday = "Wednesday";
- string thursday = "Thursday";
- string friday = "Friday";
- string saturday = "Saturday";
- string sunday = "Sunday";
- string banana = "banana";
- string apple = "apple";
- string orange = "orange";
- string grapefruit = "grapefruit";
- string kiwi = "kiwi";
- string pineapple = "pineapple";
- string grapes = "grapes";
- double priceOfProduct = -1.0;
- if (dayOfWeek == monday || dayOfWeek == tuesday ||
- dayOfWeek == wednesday || dayOfWeek == thursday ||
- dayOfWeek == friday)
- {
- if (Fruit == banana)
- {
- priceOfProduct = 2.50;
- }
- else if (Fruit == apple)
- {
- priceOfProduct = 1.20;
- }
- else if (Fruit == orange)
- {
- priceOfProduct = 0.85;
- }
- else if (Fruit == grapefruit)
- {
- priceOfProduct = 1.45;
- }
- else if (Fruit == kiwi)
- {
- priceOfProduct = 2.70;
- }
- else if (Fruit == pineapple)
- {
- priceOfProduct = 5.50;
- }
- else if (Fruit == grapes)
- {
- priceOfProduct = 3.85;
- }
- }
- else if (dayOfWeek == saturday || dayOfWeek == sunday)
- {
- if (Fruit == banana)
- {
- priceOfProduct = 2.70;
- }
- else if (Fruit == apple)
- {
- priceOfProduct = 1.25;
- }
- else if (Fruit == orange)
- {
- priceOfProduct = 0.90;
- }
- else if (Fruit == grapefruit)
- {
- priceOfProduct = 1.60;
- }
- else if (Fruit == kiwi)
- {
- priceOfProduct = 3.00;
- }
- else if (Fruit == pineapple)
- {
- priceOfProduct = 5.60;
- }
- else if (Fruit == grapes)
- {
- priceOfProduct = 4.20;
- }
- }
- if (priceOfProduct < 0)
- {
- Console.WriteLine("error");
- }
- else
- {
- double result = quаntity * priceOfProduct;
- Console.WriteLine($"{result:f2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement