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 ConsoleApp10
- {
- class Program
- {
- static void Main(string[] args)
- {
- string product = Console.ReadLine().ToLower();
- string dayofweek = Console.ReadLine().ToLower();
- double quantity = double.Parse(Console.ReadLine());
- double price = -1.0;
- string saturday = "saturday";
- string sunday = "sunday";
- string friday = "friday";
- string thursday = "thursday";
- string wednesday = "wednesday";
- string tuesday = "tuesday";
- string monday = "monday";
- string banana = "banana";
- string apple = "apple";
- string orange = "orange";
- string grapefruit = "grapefruit";
- string kiwi = "kiwi";
- string pineapple = "pineapple";
- string grapes = "grapes";
- if (dayofweek == monday ||
- dayofweek == tuesday ||
- dayofweek == wednesday ||
- dayofweek == thursday ||
- dayofweek == friday)
- {
- if (product == banana)
- {
- price = 2.50;
- }
- else if (product == apple)
- {
- price = 1.20;
- }
- 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 == banana)
- {
- price = 2.70;
- }
- else if (product == apple)
- {
- price = 1.25;
- }
- else if (product == orange)
- {
- price = 0.90;
- }
- else if (product == grapefruit)
- {
- price = 1.60;
- }
- else if (product == kiwi)
- {
- price = 3.00;
- }
- else if (product == pineapple)
- {
- price = 5.60;
- }
- else if (product == grapes)
- {
- price = 4.20;
- }
- }
- double result = price * quantity;
- if (price < 0)
- {
- Console.WriteLine("error");
- }
- else { Console.WriteLine($"{result:f3}"); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment