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;
- decimal moneyPerHour = decimal.Parse(data[1]);
- int hoursPerDay = int.Parse(data[2]);
- decimal itemPrice = decimal.Parse(data[3]);
- switch (months)
- {
- case "Feb": daysPerMonth = 28 - 10;
- break;
- case "Apr":
- case "June":
- case "Sept":
- case "Nov": daysPerMonth = 30 - 10;
- break;
- default: daysPerMonth = 31 - 10;
- break;
- }
- decimal moneyPerMonth = (moneyPerHour * hoursPerDay) * daysPerMonth;
- if (moneyPerMonth > 700)
- {
- moneyPerMonth += (moneyPerMonth * 0.1m);
- }
- if (moneyPerMonth >= itemPrice)
- {
- decimal output = moneyPerMonth - itemPrice;
- Console.WriteLine("Money left = {0:F2} leva.", output);
- }
- else
- {
- decimal output = itemPrice - moneyPerMonth;
- Console.WriteLine("Not enough money. {0:F2} leva needed.", output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement