Advertisement
Guest User

Untitled

a guest
Apr 10th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.75 KB | None | 0 0
  1. using System;
  2. namespace One
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             var gender = Console.ReadLine().ToLower();
  9.             int age = int.Parse(Console.ReadLine());
  10.             int staj = int.Parse(Console.ReadLine());
  11.             int diffmen = Math.Abs(staj - 38);
  12.             int diffwoman = Math.Abs(staj - 38);
  13.             int diffagemen = Math.Abs(age - 64);
  14.             int diffagewoman = Math.Abs(age - 64);
  15.  
  16.             if (gender == "male" || gender == "female")
  17.             {
  18.                 if (age > 1 && age < 10000)
  19.                 {
  20.                     if (staj > 1 && staj < 10000)
  21.                     {
  22.                         if (gender == "male")
  23.                         {
  24.                             if (age >= 64 && staj >= 38)
  25.                                 Console.WriteLine("Ready to retire at {0} and {1} years of experience!", age, staj);
  26.                             else if (age >= 64 && staj < 38)
  27.                                 Console.WriteLine("Old enough, but haven't worked enough. Work experience left to retirement: {0}.", diffmen);
  28.                             else if (age < 64 && staj >= 38)
  29.                                 Console.WriteLine("Worked enough, but not old enough. Years left to retirement: {0}.", diffagemen);
  30.                             else if (age < 64 && staj < 38)
  31.                                 Console.WriteLine("Too early. Years left to retirement: {0}. Work experience left to retirement: {1}.", diffagemen, diffmen);
  32.                         }
  33.                         else if (gender == "female")
  34.                         {
  35.                             if (age >= 31 && staj >= 35)
  36.                                 Console.WriteLine("Ready to retire at {0} and {1} years of experience!", age, staj);
  37.                             else if (age >= 61 && staj < 35)
  38.                                 Console.WriteLine("Old enough, but haven't worked enough. Work experience left to retirement: {0}.", diffwoman);
  39.                             else if (age < 61 && staj >= 35)
  40.                                 Console.WriteLine("Worked enough, but not old enough. Years left to retirement: {0}.", diffagewoman);
  41.                             else if (age < 61 && staj < 35)
  42.                                 Console.WriteLine("Too early. Years left to retirement: {0}. Work experience left to retirement: {1}.", diffagewoman, diffwoman);
  43.                         }
  44.                     }
  45.                     else
  46.                         Console.WriteLine("Invalid input.");
  47.                 }
  48.                 else
  49.                     Console.WriteLine("Invalid input.");
  50.             }
  51.             else
  52.                 Console.WriteLine("Invalid input.");
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement