Advertisement
Go0dtry

Driving age program

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