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
- {
- class Program
- {
- static void Main(string[] args)
- {
- var fruit = Console.ReadLine().ToLower();
- var day = Console.ReadLine().ToLower();
- var quantity = decimal.Parse(Console.ReadLine());
- string[] array1 = { "banana", "apple", "orange", "grapefruit", "kiwi", "pineapple", "grapes" };
- decimal[] prices = { 2.50M, 1.20M, 0.85M, 1.45M, 2.70M, 5.50M, 3.85M };
- decimal[] prices1 = { 2.70M, 1.25M, 0.90M, 1.60M, 3.00M, 5.60M, 4.20M };
- if ((day == "monday"|| day == "tuesday"|| day == "wednesday"|| day == "thursday"|| day == "friday")&&
- (fruit == "banana" || fruit == "apple" || fruit == "orange" || fruit == "grapefruit" || fruit == "kiwi" || fruit == "pineapple" || fruit == "grapes"))
- {
- for (int i = 0; i < array1.Length; i++)
- {
- if (array1[i] == fruit)
- {
- decimal sum = prices[i];
- Console.WriteLine(Math.Round((sum * quantity), 2));
- }
- }
- }
- else if (day == "saturday"|| day == "sunday")
- {
- for (int i = 0; i < array1.Length; i++)
- {
- if (array1[i] == fruit)
- {
- decimal sum = prices1[i];
- Console.WriteLine(Math.Round ((sum * quantity),2));
- }
- }
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement