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 programka
- {
- class Program
- {
- static void Main(string[] args)
- {
- double salary = double.Parse(Console.ReadLine());
- int timeWorked = int.Parse(Console.ReadLine());
- string member = Console.ReadLine();
- double currentSalary = 0;
- int moreyears = 0;
- for (int i = 1; i <= timeWorked; i++)
- {
- salary = salary + (salary * 0.06);
- if (member == "Yes" && i % 10 != 5 && i % 10 != 0)
- {
- salary = salary - (salary * 0.01);
- }
- if (i % 10 == 5)
- {
- salary += 100;
- }
- if (i % 10 == 0)
- {
- salary += 200;
- }
- }
- currentSalary = salary;
- for (int i = timeWorked; i <= 10000; i++)
- {
- if (currentSalary > 5000)
- {
- break;
- }
- currentSalary = currentSalary + (currentSalary * 0.06);
- if (member == "Yes" && i % 10 != 5 && i % 10 != 0)
- {
- currentSalary = currentSalary - (currentSalary * 0.01);
- }
- if (i % 10 == 5)
- {
- currentSalary += 100;
- }
- if (i % 10 == 0)
- {
- currentSalary += 200;
- }
- moreyears += 1;
- }
- if (salary < 5000)
- {
- moreyears -= 1;
- Console.WriteLine($"Current salary: {salary:f2}");
- Console.WriteLine($"{moreyears} more years to max salary.");
- }
- else
- {
- moreyears = 0;
- salary = 5000;
- Console.WriteLine($"Current salary: {salary:f2}");
- Console.WriteLine($"{moreyears} more years to max salary.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment