Advertisement
fbinnzhivko

02.Dream Item

Mar 13th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Program
  5. {
  6.     static void Main()
  7.     {
  8.  
  9.         string[] input = Console.ReadLine().Split('\\');
  10.  
  11.         string month = input[0];
  12.         var moneyPerHour = decimal.Parse(input[1]);
  13.         int hourPerDay = int.Parse(input[2]);
  14.         var priceOfItem = decimal.Parse(input[3]);
  15.         int workingDays = 30 - 10;
  16.         //Console.WriteLine(moounth);
  17.         //Console.WriteLine(moneyPerHour);
  18.         //Console.WriteLine(hourPerDay);
  19.         //Console.WriteLine(priceOfItem);
  20.  
  21.         if (month == "Feb")
  22.         {
  23.             workingDays = 28 - 10;
  24.         }
  25.         else if (month == "Jan" || month == "March" || month == "May" || month == "July" || month == "Aug" || month == "Oct" || month == "Dec")
  26.         {
  27.             workingDays = 31 - 10;
  28.         }
  29.         decimal moneyForMounht = workingDays * moneyPerHour * hourPerDay;
  30.         if (moneyForMounht >= 700) { moneyForMounht = 1.1m * moneyForMounht; }
  31.  
  32.         //Console.WriteLine(moneyForMounht);
  33.         var restMoney = moneyForMounht - priceOfItem;
  34.         //Console.WriteLine(restMoney);
  35.  
  36.         if (moneyForMounht < priceOfItem)
  37.         {
  38.  
  39.             Console.WriteLine("Not enough money. {0:f2} leva needed.", priceOfItem - moneyForMounht);
  40.         }
  41.         else
  42.         {
  43.             Console.WriteLine("Money left = {0:f2} leva.",restMoney );
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement