Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace exam_Salary
- {
- class Program
- {
- static void Main(string[] args)
- {
- double startingSalary = double.Parse(Console.ReadLine());
- int workingYears = int.Parse(Console.ReadLine());
- string sindicateInput = Console.ReadLine();
- bool sindicate = IsSindicate(sindicateInput);
- for (int i = 1; i <= workingYears; i++)
- {
- startingSalary = CalcSalary(startingSalary, i, sindicate);
- if (startingSalary >= 5000)
- {
- startingSalary = 5000;
- break;
- }
- }
- double potentialSalary = startingSalary;
- if (potentialSalary == 5000)
- {
- Console.WriteLine($"Current salary: {startingSalary:f2}");
- Console.WriteLine($"{0} more years to max salary.");
- }
- else
- {
- int j = 0;
- while (potentialSalary < 5000)
- {
- j++;
- potentialSalary = CalcSalary(potentialSalary, j + workingYears, sindicate);
- }
- Console.WriteLine($"Current salary: {startingSalary:f2}");
- Console.WriteLine($"{j - 1} more years to max salary.");
- }
- }
- private static double CalcSalary(double startingSalary, int i, bool sindicate)
- {
- startingSalary *= 1.06;
- if (i % 5 == 0)
- {
- startingSalary += 100;
- }
- if (i % 10 == 0)
- {
- startingSalary += 100;
- }
- if (i % 5 != 0 && sindicate)
- {
- startingSalary *= 0.99;
- }
- return startingSalary;
- }
- private static bool IsSindicate(string sindicateInput)
- {
- bool sindicate = false;
- if (sindicateInput == "Yes")
- {
- sindicate = true;
- }
- return sindicate;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment