Advertisement
Guest User

02. Dream Item

a guest
Mar 30th, 2015
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4.  
  5.  
  6. class Program
  7. {
  8.     static void Main()
  9.     {
  10.         string []inp = Console.ReadLine().Split('\\');
  11.         string day = inp[0];
  12.         decimal moneyPerHour = decimal.Parse(inp[1]);
  13.         decimal hours = decimal.Parse(inp[2]);
  14.         decimal itemPrice = decimal.Parse(inp[3]);
  15.         decimal EarnedMoney = 0m;
  16.         if (day == "Feb")
  17.         {
  18.             EarnedMoney = 18 * (moneyPerHour * hours);
  19.         }
  20.         else if (day == "Jan" || day == "March" || day == "May" || day == "July" || day == "Aug" || day == "Oct" || day == "Dec")
  21.         {
  22.             EarnedMoney = 21 * (moneyPerHour * hours);
  23.         }
  24.         else
  25.         {
  26.             EarnedMoney = 20 * (moneyPerHour * hours);
  27.  
  28.         }
  29.         if (EarnedMoney > 700)
  30.         {
  31.             EarnedMoney += EarnedMoney * 0.1m;
  32.         }
  33.         decimal diff = EarnedMoney -itemPrice;
  34.         if (diff >=0)
  35.         {
  36.             Console.WriteLine("Money left = {0:F2} leva.",diff);
  37.         }
  38.         else
  39.         {
  40.             Console.WriteLine("Not enough money. {0:f2} leva needed.",itemPrice - EarnedMoney);
  41.         }
  42.  
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement