Guest User

Untitled

a guest
Oct 12th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _02.DreamItem
  8. {
  9.     class DreamItem
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string input = Console.ReadLine();
  14.             string[] splitInput = input.Split('\\');
  15.             string month = splitInput[0];
  16.             decimal moneyPerHour = Convert.ToDecimal(splitInput[1]);
  17.             decimal hoursPerDay = Convert.ToDecimal(splitInput[2]);
  18.             decimal itemPrize = Convert.ToDecimal(splitInput[3]);
  19.  
  20.             int deysInMonth = 0;
  21.            
  22.             switch (month)
  23.             {
  24.                 case "Jan": deysInMonth = 31; break;
  25.                 case "Feb": deysInMonth = 28; break;
  26.                 case "Mar": deysInMonth = 31; break;
  27.                 case "Apr": deysInMonth = 30; break;
  28.                 case "May": deysInMonth = 31; break;
  29.                 case "June": deysInMonth = 30; break;
  30.                 case "July": deysInMonth = 31; break;
  31.                 case "Aug": deysInMonth = 31; break;
  32.                 case "Sept": deysInMonth = 30; break;
  33.                 case "Oct": deysInMonth = 31; break;
  34.                 case "Nov": deysInMonth = 30; break;
  35.                 case "Dec": deysInMonth = 31; break;
  36.             }
  37.  
  38.             decimal deysWorking = deysInMonth - 10;
  39.             decimal sellary = deysWorking * moneyPerHour * hoursPerDay;
  40.  
  41.             if (sellary > 700)
  42.             {
  43.                 sellary += sellary * 0.1M;//sellary + ((sellary * 10) / 100);
  44.             }
  45.  
  46.             decimal totalMoney = sellary - itemPrize;
  47.             if (totalMoney >= 0)
  48.             {
  49.                 Console.WriteLine("Money left = {0:F2} leva.", Math.Abs(sellary - itemPrize));
  50.             }
  51.             else
  52.             {
  53.                 Console.WriteLine("Not enough money. {0:F2} leva needed.", Math.Abs(sellary - itemPrize));
  54.             }
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment