Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2018
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.62 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 Salary
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var salary = decimal.Parse(Console.ReadLine());
  14.             var workYears = int.Parse(Console.ReadLine());
  15.             string syndicate = Console.ReadLine().ToLower();
  16.             var neededYears = 0.0;
  17.  
  18.             for (int i = 1; ; i++)
  19.             {
  20.                 salary *= 1.06m;
  21.  
  22.                 if (i % 10 == 5)
  23.                 {
  24.                     salary += 100;
  25.                 }
  26.                 if (i % 10 == 0)
  27.                 {
  28.                     salary += 200;
  29.                 }
  30.                 if (syndicate == "yes" && i % 10 != 5 && i % 10 != 0)
  31.                 {
  32.                     salary *= 0.99m;
  33.                 }
  34.                 if (salary >= 5000)
  35.                 {
  36.                     if (i <= workYears)
  37.                     {
  38.                         Console.WriteLine($"Current salary: 5000.00");
  39.                         Console.WriteLine($"0 more years to max salary.");
  40.                         return;
  41.                     }
  42.                     else
  43.                     {
  44.                         neededYears = i - 1.0;
  45.                         break;
  46.                     }
  47.                 }
  48.                 if (i == workYears)
  49.                 {
  50.                     Console.WriteLine($"Current salary: {salary:F2}");
  51.                 }
  52.  
  53.             }
  54.             Console.WriteLine($"{neededYears - workYears} more years to max salary.");
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement