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;
- class FruitMarket
- {
- static void Main()
- {
- double quantity;
- string product;
- double fruits = 0.0;
- double vegs = 0.0;
- double bananas = 0.0;
- string day = Console.ReadLine();
- for (int i = 0; i < 3; i++ )
- {
- quantity = double.Parse(Console.ReadLine());
- product = Console.ReadLine();
- double current_sum = 0.0 ;
- if (product == "banana")
- {
- current_sum = quantity * 1.80;
- bananas = current_sum;
- fruits += current_sum;
- }
- else if (product == "cucumber")
- {
- current_sum = quantity * 2.75;
- vegs += current_sum;
- }
- else if (product == "tomato")
- {
- current_sum = quantity * 3.20;
- vegs += current_sum;
- }
- else if (product == "orange")
- {
- current_sum = quantity * 1.60;
- fruits += current_sum;
- }
- else if (product == "apple")
- {
- current_sum = quantity * 0.86;
- fruits += current_sum;
- }
- }
- //calculate discount
- double total = fruits + vegs;
- double off = 0.0;
- if (day == "Friday")
- {
- off = (fruits + vegs) / 10;
- }
- else if (day == "Sunday")
- {
- off = (fruits + vegs) / 20;
- }
- else if (day == "Tuesday")
- {
- off = fruits / 5;
- }
- else if (day == "Wednesday")
- {
- off = vegs / 10;
- }
- else if (day == "Thursday")
- {
- off = (bananas * 3) / 10;
- }
- double result = total - off;
- Console.WriteLine("{0:0.00}",Math.Round(result, 2));
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement