Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace SquareOfStars
- {
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- string fruit = Console.ReadLine().ToLower();
- string dayOfTheWeek = Console.ReadLine().ToLower();
- double num = double.Parse(Console.ReadLine());
- double result = 0;
- double price=-1;
- if (dayOfTheWeek == "monday" ||
- dayOfTheWeek == "tuesday" ||
- dayOfTheWeek == "wednesday" ||
- dayOfTheWeek == "thursday" ||
- dayOfTheWeek == "friday")
- {
- if (fruit == "banana")
- {
- price=2.5d;
- }
- else if (fruit == "apple")
- {
- price=1.2d;
- }
- else if (fruit == "orange")
- {
- price=0.85d;
- }
- else if (fruit == "grapefruit")
- {
- price=1.45d;
- }
- else if (fruit == "kiwi")
- {
- price=2.7d;
- }
- else if (fruit == "pineapple")
- {
- price=5.5d;
- }
- else if (fruit == "grapes")
- {
- price=3.85d;
- }
- }
- else if (dayOfTheWeek == "sunday" ||
- dayOfTheWeek == "saturday")
- {
- if (fruit == "banana")
- {
- price=2.7d;
- }
- else if (fruit == "apple")
- {
- price=1.25d;
- }
- else if (fruit == "orange")
- {
- price=0.9d;
- }
- else if (fruit == "grapefruit")
- {
- price=1.6d;
- }
- else if (fruit == "kiwi")
- {
- price=3.0d;
- }
- else if (fruit == "pineapple")
- {
- price=5.6d;
- }
- else if (fruit == "grapes")
- {
- price=4.2d;
- }
- }
- if(price!=-1)
- {
- result=price*num;
- Console.WriteLine("{0:f2}", result);
- }
- else{
- Console.WriteLine("error");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement