Advertisement
Guest User

retirement

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