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 fruitShop
- {
- class Program
- {
- static void Main(string[] args)
- {
- {
- string fruits = Console.ReadLine().ToLower();
- string dayOfWeek = Console.ReadLine().ToLower();
- double quantity = double.Parse(Console.ReadLine());
- double price = 0;
- if (dayOfWeek == "monday" || dayOfWeek == "tuesday" || dayOfWeek == "wednesday" || dayOfWeek == "thursday" ||
- dayOfWeek == "friday")
- {
- if (fruits == "banana") price = 2.50;
- {
- price = 2.50 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- }
- else if (fruits == "apple") price = 1.20;
- {
- price = 1.20 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "orange") price = 0.85;
- {
- price = 0.85 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "grapefruit") price = 1.45;
- {
- price = 1.45 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "kiwi") price = 2.70;
- {
- price = 2.70 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "pineapple") price = 5.50;
- {
- price = 5.50 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "grapes") price = 3.85;
- {
- price = 3.85 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- else if (dayOfWeek == "saturday" || dayOfWeek == "sunday")
- {
- if (fruits == "banana") price = 2.70;
- {
- price = 2.70 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- }
- else if (fruits == "apple") price = 1.25;
- {
- price = 1.25 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "orange") price = 0.90;
- {
- price = 0.90 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "grapefruit") price = 1.60;
- {
- price = 1.60 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "kiwi") price = 3.00;
- {
- price = 3.00 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "pineapple") price = 5.60;
- {
- price = 5.60 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else if (fruits == "grapes") price = 4.20;
- {
- price = 4.20 * quantity;
- if (price >= 0)
- {
- Console.WriteLine("{0:f2}", price * quantity);
- }
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- else
- {
- Console.WriteLine("error");
- }
- Console.WriteLine($"{Math.Round(price, 2)}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment