Advertisement
Go0dtry

Driving age / adjusted for and if.

Jul 16th, 2012
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. for(int age = 16;age<=20;age++){
  9. System.out.println(age);
  10.  
  11.  
  12.  
  13. if (age >= 16){
  14. System.out.println("Reached minimum age limit.");
  15. }else{
  16. System.out.println("Must wait until you reach the minimum age!");
  17. }
  18. }
  19. switch (age){
  20. case 10:
  21. System.out.println("You can not get your drivers license!");
  22. break;
  23. case 16:
  24. System.out.println("You can get your drivers license!");
  25. break;
  26. case 20:
  27. System.out.println("you are old enough to drive!");
  28. default:
  29. System.out.println("I don't know how old you are.");
  30. }
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement