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 _07.Fruit_Shop
- {
- class Program
- {
- static void Main(string[] args)
- {
- string product = Console.ReadLine();
- var dayOfWeek = Console.ReadLine();
- double quantity = double.Parse(Console.ReadLine());
- double price = 0.0;
- bool dayOfWeek1 = (dayOfWeek == "Monday" || dayOfWeek == "Thursday" || dayOfWeek == "Tuesday"
- || dayOfWeek == "Wednesday" || dayOfWeek == "Friday");
- bool dayOfWeek2 = dayOfWeek == "Saturday" || dayOfWeek == "Sunday";
- if (dayOfWeek1 == true)
- {
- 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;
- }
- }
- /////////////////////////////////////
- if (dayOfWeek2 == true)
- {
- 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;
- }
- }
- else if (dayOfWeek1 == false)
- {
- Console.WriteLine("error");
- }
- else if (dayOfWeek2 == false)
- {
- Console.WriteLine("error");
- }
- else if (price < 0)
- {
- Console.WriteLine("error");
- }
- Console.WriteLine("{0:F2}", quantity * price);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement