Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class Two_2
- {
- static void Main()
- {
- string input = Console.ReadLine();
- string[] stringArray = input.Split(new Char[] { '\\' });
- string month = stringArray[0];
- decimal moneyPerHour = decimal.Parse(stringArray[1]);
- decimal hoursPerDay = decimal.Parse(stringArray[2]);
- decimal item = decimal.Parse(stringArray[3]);
- decimal daysInMonth = Months(month);
- decimal workDays = daysInMonth - 10;
- decimal salary = (workDays * hoursPerDay * moneyPerHour);
- decimal bonus = (decimal) ((float)salary * 0.1);
- if (salary > 700)
- {
- salary += bonus;
- }
- if (salary >= item)
- {
- decimal result = salary - item;
- Console.WriteLine("Money left = {0:0.00} leva.", result);
- }
- else
- {
- decimal result = 0;
- if (salary > 0)
- {
- result = item - salary;
- }
- else
- {
- result = salary - item;
- result *= -1;
- }
- Console.WriteLine("Not enough money. {0:0.00} leva needed.", result);
- }
- }
- public static decimal Months(string input)
- {
- switch (input)
- {
- case "Jan":
- return 31;
- case "Feb":
- return 28;
- case "March":
- return 31;
- case "Apr":
- return 30;
- case "May":
- return 31;
- case "June":
- return 30;
- case "July":
- return 31;
- case "Aug":
- return 31;
- case "Sept":
- return 30;
- case "Oct":
- return 31;
- case "Nov":
- return 30;
- case "Dec":
- return 31;
- default:
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement