Advertisement
TeMePyT

Untitled

Jan 21st, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.86 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 Zaplata_2ri_Opit
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double Salary = double.Parse(Console.ReadLine());
  14.             int yearsWorked = int.Parse(Console.ReadLine());
  15.             string sindicate = Console.ReadLine();
  16.  
  17.             double currentSalary = Salary;
  18.             for (int i = 1; i <= yearsWorked; i++)
  19.             {
  20.                 if (i % 10 == 5)
  21.                 {
  22.                     currentSalary = currentSalary + (currentSalary * 0.06);
  23.                     currentSalary += 100;
  24.  
  25.                 }
  26.                 else if (i % 10 == 0)
  27.                 {
  28.                     currentSalary = currentSalary + (currentSalary * 0.06);
  29.                     currentSalary += 200;
  30.  
  31.                 }
  32.                 else
  33.                 {
  34.                     if (sindicate == "No")
  35.                     {
  36.                         currentSalary = currentSalary + (currentSalary * 0.06);
  37.                     }
  38.                     else
  39.                     {
  40.                         currentSalary = currentSalary + (currentSalary * 0.06) - (currentSalary * 0.01);
  41.                     }
  42.                 }
  43.                 if (currentSalary >= 5000)
  44.                 {
  45.                     Console.WriteLine("Current salary: 5000.00");
  46.                     Console.WriteLine("0 more years to max salary.");
  47.                     break;
  48.                 }
  49.                 if (i == yearsWorked)
  50.                 {
  51.                     double currentSalaryToMax = currentSalary;
  52.                     for (int j = i; j <= 45; j++)
  53.                     {
  54.                         int yearstomax = j - yearsWorked;
  55.  
  56.                         if (j % 10 == 5)
  57.                         {
  58.                             currentSalaryToMax = currentSalaryToMax + (currentSalaryToMax * 0.06);
  59.                             currentSalaryToMax += 100;
  60.  
  61.                         }
  62.                         else if (j % 10 == 0)
  63.                         {
  64.                             currentSalaryToMax = currentSalaryToMax + (currentSalaryToMax * 0.06);
  65.                             currentSalaryToMax += 200;
  66.  
  67.                         }
  68.                         else
  69.                         {
  70.                             currentSalaryToMax = currentSalaryToMax + (currentSalaryToMax * 0.06);
  71.                         }
  72.                         if (currentSalaryToMax >= 5000)
  73.                         {
  74.                             Console.WriteLine($"Current salary: {currentSalary:F2}");
  75.                             Console.WriteLine($"{yearstomax} more years to max salary.");
  76.                             break;
  77.                         }
  78.                     }
  79.                 }
  80.             }
  81.         }
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement