Advertisement
Guest User

Code

a guest
Dec 4th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. //Kaylee Goldbarth
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Chpt8_Project {
  6.  
  7. public static void main(String[] args) {
  8. Scanner input = new Scanner(System.in);
  9. int[][] years = new int[2][10];
  10.  
  11. for (int i = 0; i <years.length; i++) {
  12. System.out.println("Enter current age (must be between ages 19 and 70): ");
  13. years[i][0] = input.nextInt();
  14. System.out.println("Enter desired retirement age (can only be ages 62, 66, or 70): ");
  15. years[i][1] = input.nextInt();
  16.  
  17. do{
  18. years[i][0] = input.nextInt();
  19. }while(years[i][0] < 19 && years[i][0] > 70);
  20.  
  21. do{
  22. years[0][i] = input.nextInt();
  23. }while(years[0][i] ==62 && years[0][i] ==66 && years[0][i] ==70);
  24.  
  25. System.out.println("The current age and desired retirement age for employee #" + (i+1) + " is: " + years[i][0] + " " + years[i][1]);
  26. System.out.println("Employee #" + (i+1) + " has to work" + (years[i][1] - years[i][0]) + "years before they can retire");
  27.  
  28. }
  29.  
  30.  
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement