Advertisement
Sim0o0na

3. Retirement

Mar 12th, 2018
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 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 _03
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string gender = Console.ReadLine();
  14. int age = int.Parse(Console.ReadLine());
  15. int yearsWork = int.Parse(Console.ReadLine());
  16.  
  17. if (gender == "male")
  18. {
  19. int diffYears = Math.Abs(yearsWork - 38);
  20. int diffAge = Math.Abs(age - 64);
  21.  
  22. if (age >= 64 && yearsWork >= 38)
  23. {
  24. Console.WriteLine("Ready to retire at {0} and {1} years of experience!", age, yearsWork);
  25. }
  26. else if (age < 64 && yearsWork >= 38)
  27. {
  28.  
  29. Console.WriteLine("Worked enough, but not old enough. Years left to retirement: {0}.", diffAge);
  30. }
  31. else if (age >= 64 && yearsWork < 38)
  32. {
  33.  
  34. Console.WriteLine("Old enough, but haven't worked enough. Work experience left to retirement: {0}.", diffYears);
  35. }
  36. else
  37. {
  38. Console.WriteLine("Too early. Years left to retirement: {0}. Work experience left to retirement: {1}.",diffAge,diffYears);
  39. }
  40. }
  41. else if (gender == "female")
  42. {
  43. int diffYears = Math.Abs(yearsWork - 35);
  44. int diffAge = Math.Abs(age - 61);
  45.  
  46. if (age >= 61 && yearsWork >= 35)
  47. {
  48. Console.WriteLine("Ready to retire at {0} and {1} years of experience!", age, yearsWork);
  49. }
  50. else if (age < 61 && yearsWork >= 35)
  51. {
  52.  
  53. Console.WriteLine("Worked enough, but not old enough. Years left to retirement: {0}.", diffAge);
  54. }
  55. else if (age >= 61 && yearsWork < 35)
  56. {
  57.  
  58. Console.WriteLine("Old enough, but haven't worked enough. Work experience left to retirement: {0}.", diffYears);
  59. }
  60. else
  61. {
  62. Console.WriteLine("Too early. Years left to retirement: {0}. Work experience left to retirement: {1}.", diffAge, diffYears);
  63. }
  64. }
  65. else
  66. {
  67. Console.WriteLine("Invalid input.");
  68. }
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement