SHARE
TWEET
Untitled
a guest
Jan 29th, 2018
55
Never
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
- {
- class Program
- {
- static void Main(string[] args)
- {
- string fruit = Console.ReadLine().ToLower();
- string day = Console.ReadLine().ToLower();
- double quantity = double.Parse(Console.ReadLine());
- double price = 0;
- bool error = false;
- if (day == "saturday" || day == "sunday")
- {
- if (fruit == "banana")
- {
- price = 2.70;
- }
- else if (fruit == "apple")
- {
- price = 1.25;
- }
- else if (fruit == "orange")
- {
- price = 0.90;
- }
- else if (fruit == "grapefruit")
- {
- price = 1.60;
- }
- else if (fruit == "kiwi")
- {
- price = 3.00;
- }
- else if (fruit == "pineapple")
- {
- price = 5.60;
- }
- else if (fruit == "grapes")
- {
- price = 4.20;
- }
- else
- {
- error = true;
- }
- }
- else if (day == "monday" || day == "tuesday" || day == "wednesday" || day == "thirsday" || day == "friday")
- {
- if (fruit == "banana")
- {
- price = 2.50;
- }
- else if (fruit == "apple")
- {
- price = 1.20;
- }
- else if (fruit == "orange")
- {
- price = 0.85;
- }
- else if (fruit == "grapefruit")
- {
- price = 1.45;
- }
- else if (fruit == "kiwi")
- {
- price = 2.70;
- }
- else if (fruit == "pineapple")
- {
- price = 5.50;
- }
- else if (fruit == "grapes")
- {
- price = 3.85;
- }
- else
- {
- error = true;
- }
- }
- if (error)
- {
- Console.WriteLine("error");
- }
- else
- {
- double totalPrice = price * quantity;
- Console.WriteLine(Math.Round(totalPrice, 2));
- }
- }
- }
- }
RAW Paste Data

