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 product = Console.ReadLine();
- string dayOfWeek = Console.ReadLine().ToLower();
- double quantity = 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 apple = "apple";
- string banana = "banana";
- string orange = "orange";
- string grapefruit = "grapefruit";
- string kiwi = "kiwi";
- string pineapple = "pineapple";
- string grapes = "grapes";
- double price = -1.0;
- if (dayOfWeek == monday ||
- dayOfWeek == tuesday ||
- dayOfWeek == wednesday ||
- dayOfWeek == thursday ||
- dayOfWeek == friday)
- {
- if (product == apple)
- {
- price = 1.20;
- }
- else if (product == banana)
- {
- price = 2.5;
- }
- else if (product == orange)
- {
- price = 0.85;
- }
- else if (product == grapefruit)
- {
- price = 1.45;
- }
- else if (product == kiwi)
- {
- price = 2.70;
- }
- else if (product == pineapple)
- {
- price = 5.50;
- }
- else if (product == grapes)
- {
- price = 3.85;
- }
- }
- else if (dayOfWeek == saturday || dayOfWeek == sunday)
- {
- if (product == apple)
- {
- price = 1.25;
- }
- else if (product == banana)
- {
- price = 2.70;
- }
- else if (product == orange)
- {
- price = 0.90;
- }
- else if (product == grapefruit)
- {
- price = 1.60;
- }
- else if (product == kiwi)
- {
- price = 3.0;
- }
- else if (product == pineapple)
- {
- price = 5.60;
- }
- else if (product == grapes)
- {
- price = 4.20;
- }
- }
- if (price < 0)
- {
- Console.WriteLine("error");
- }
- else
- {
- double result = quantity * price;
- Console.WriteLine($"{result:f2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement