Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PlaceToWriteCode
- {
- class Program
- {
- static void Main(string[] args)
- {
- string fruit = Console.ReadLine();
- string dayOfTheWeek = Console.ReadLine();
- double quantity = double.Parse(Console.ReadLine());
- double totalPrice = 0.0;
- if (dayOfTheWeek == "Monday" || dayOfTheWeek == "Tuesday" || dayOfTheWeek == "Wednesday" || dayOfTheWeek == "Thursday" || dayOfTheWeek == "Friday")
- {
- if (fruit == "banana")
- {
- totalPrice = quantity * 2.5;
- }
- if (fruit == "apple")
- {
- totalPrice = quantity * 1.2;
- }
- if (fruit == "orange")
- {
- totalPrice = quantity * 0.85;
- }
- if (fruit == "grapefruit")
- {
- totalPrice = quantity * 1.45;
- }
- if (fruit == "kiwi")
- {
- totalPrice = quantity * 2.7;
- }
- if (fruit == "pineapple")
- {
- totalPrice = quantity * 5.5;
- }
- if (fruit == "grapes")
- {
- totalPrice = quantity * 3.85;
- }
- Console.WriteLine($"{totalPrice:f2}");
- else
- {
- Console.WriteLine("error");
- }
- }
- else if (dayOfTheWeek == "Saturday" || dayOfTheWeek == "Sunday")
- {
- if (fruit == "banana")
- {
- totalPrice = quantity * 2.7;
- }
- if (fruit == "apple")
- {
- totalPrice = quantity * 1.25;
- }
- if (fruit == "orange")
- {
- totalPrice = quantity * 0.9;
- }
- if (fruit == "grapefruit")
- {
- totalPrice = quantity * 1.6;
- }
- if (fruit == "kiwi")
- {
- totalPrice = quantity * 3;
- }
- if (fruit == "pineapple")
- {
- totalPrice = quantity * 5.6;
- }
- if (fruit == "grapes")
- {
- totalPrice = quantity * 4.2;
- }
- Console.WriteLine($"{totalPrice:f2}");
- else
- {
- Console.WriteLine("error");
- }
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment