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 DreamItem
- {
- static void Main()
- {
- var data = Console.ReadLine().Split('\\');
- string months = data[0];
- int daysPerMonth;
- double moneyPerHour = double.Parse(data[1]);
- int hoursPerDay = int.Parse(data[2]);
- double itemPrice = double.Parse(data[3]);
- switch (months)
- {
- case "Jan":
- case "Mar":
- case "May":
- case "July":
- case "Aug":
- case "Oct":
- case "Dec": daysPerMonth = 31 - 10;
- break;
- case "Apr":
- case "June":
- case "Sept":
- case "Nov": daysPerMonth = 30 - 10;
- break;
- default: daysPerMonth = 28 - 10;
- break;
- }
- double moneyPerMonth = (moneyPerHour * hoursPerDay) * daysPerMonth;
- if (moneyPerMonth > 700)
- {
- moneyPerMonth += (moneyPerMonth * 0.1);
- }
- if (moneyPerMonth > itemPrice )
- {
- double output = moneyPerMonth - itemPrice;
- Console.WriteLine("Money left = {0:F2} leva.", output);
- }
- else
- {
- double output = itemPrice - moneyPerMonth;
- Console.WriteLine("Not enough money. {0:F2} leva needed.", output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement