Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Statements
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- string fruit = Console.ReadLine().ToLower();
- string day = Console.ReadLine().ToLower();
- var ammount = double.Parse(Console.ReadLine());
- bool dayIsNotWeekend = day != "sunday" && day != "saturday";
- double price = -1.0;
- if (fruit == "banana")
- {
- price = dayIsNotWeekend ? 2.50 : 2.70;
- }
- else if (fruit == "apple")
- {
- price = dayIsNotWeekend ? 1.20 : 1.25;
- }
- else if (fruit == "orange")
- {
- price = dayIsNotWeekend ? 0.85 : 0.9;
- }
- else if (fruit == "grapefruit")
- {
- price = dayIsNotWeekend ? 1.45 : 1.60;
- }
- else if (fruit == "kiwi")
- {
- price = dayIsNotWeekend ? 2.70 : 3.00;
- }
- else if (fruit == "pineapple")
- {
- price = dayIsNotWeekend ? 5.50 : 5.60;
- }
- else if (fruit == "grapes")
- {
- price = dayIsNotWeekend ? 3.85 : 4.20;
- }
- double result = ammount * price;
- if ((day == "monday" ||
- day == "tuesday" ||
- day == "wednesday" ||
- day == "thursday" ||
- day == "friday" ||
- day == "saturday" ||
- day == "sunday") &&
- result >= 0)
- {
- Console.WriteLine(Math.Round(result, 2));
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement