Guest User

Untitled

a guest
Jul 6th, 2018
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace programka
  9.  
  10.  
  11. {
  12. class Program
  13. {
  14. static void Main(string[] args)
  15. {
  16. double salary = double.Parse(Console.ReadLine());
  17. int timeWorked = int.Parse(Console.ReadLine());
  18. string member = Console.ReadLine();
  19.  
  20. double currentSalary = 0;
  21. int moreyears = 0;
  22.  
  23. for (int i = 1; i <= timeWorked; i++)
  24. {
  25. salary = salary + (salary * 0.06);
  26. if (member == "Yes" && i % 10 != 5 && i % 10 != 0)
  27. {
  28. salary = salary - (salary * 0.01);
  29. }
  30. if (i % 10 == 5)
  31. {
  32. salary += 100;
  33. }
  34. if (i % 10 == 0)
  35. {
  36. salary += 200;
  37. }
  38. }
  39. currentSalary = salary;
  40.  
  41. for (int i = timeWorked; i <= 10000; i++)
  42. {
  43. if (currentSalary > 5000)
  44. {
  45. break;
  46. }
  47. currentSalary = currentSalary + (currentSalary * 0.06);
  48. if (member == "Yes" && i % 10 != 5 && i % 10 != 0)
  49. {
  50. currentSalary = currentSalary - (currentSalary * 0.01);
  51. }
  52. if (i % 10 == 5)
  53. {
  54. currentSalary += 100;
  55. }
  56. if (i % 10 == 0)
  57. {
  58. currentSalary += 200;
  59. }
  60. moreyears += 1;
  61.  
  62. }
  63. if (salary < 5000)
  64. {
  65. moreyears -= 1;
  66. Console.WriteLine($"Current salary: {salary:f2}");
  67. Console.WriteLine($"{moreyears} more years to max salary.");
  68. }
  69. else
  70. {
  71. moreyears = 0;
  72. salary = 5000;
  73. Console.WriteLine($"Current salary: {salary:f2}");
  74. Console.WriteLine($"{moreyears} more years to max salary.");
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
  81. }
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment