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 Fruit_Shop_if_
- {
- class Program
- {
- static void Main(string[] args)
- {
- string fruit = Console.ReadLine().ToLower();
- string dayOfTheWeek = Console.ReadLine().ToLower();
- double num = double.Parse(Console.ReadLine());
- double result = -1;
- if (dayOfTheWeek == "monday" ||
- dayOfTheWeek == "tuesday" ||
- dayOfTheWeek == "wednesday" ||
- dayOfTheWeek == "thursday" ||
- dayOfTheWeek == "friday")
- {
- if (fruit == "banana")
- {
- result = num * 2.5d;
- }
- else if (fruit == "apple")
- {
- result = num * 1.2d;
- }
- else if (fruit == "orange")
- {
- result = num * 0.85d;
- }
- else if (fruit == "grapefruit")
- {
- result = num * 1.45d;
- }
- else if (fruit == "kiwi")
- {
- result = num * 2.7d;
- }
- else if (fruit == "pineapple")
- {
- result = num * 5.5d;
- }
- else if (fruit == "grapes")
- {
- result = num * 3.85d;
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- else if (dayOfTheWeek == "sunday" ||
- dayOfTheWeek == "saturday")
- {
- if (fruit == "banana")
- {
- result = num * 2.7d;
- }
- else if (fruit == "apple")
- {
- result = num * 1.25d;
- }
- else if (fruit == "orange")
- {
- result = num * 0.9d;
- }
- else if (fruit == "grapefruit")
- {
- result = num * 1.6d;
- }
- else if (fruit == "kiwi")
- {
- result = num * 3.0d;
- }
- else if (fruit == "pineapple")
- {
- result = num * 5.6d;
- }
- else if (fruit == "grapes")
- {
- result = num * 4.2d;
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- else
- {
- Console.WriteLine("error");
- }
- if (result >= 0)
- {
- Console.WriteLine("{0:F2}", result);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement