Advertisement
Go0dtry

DrivingAge revised...maybe?

Jul 16th, 2012
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 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. public static void forLoop(String light){
  12.  
  13. for(int age = 1;age<=99;age+=20){
  14. System.out.println(age);
  15. }
  16.  
  17. int age = 16;
  18.  
  19. }
  20.  
  21.  
  22. public static void ifElse(String age){
  23.  
  24. if (age.equals(16)){
  25. System.out.println("Reached minimum age limit.");
  26. }else{
  27. System.out.println("Must wait until you reach the minimum age!");
  28. }
  29. }
  30.  
  31.  
  32. public static void switchMethod(String light){
  33.  
  34. DrivingAge age = new DrivingAge();
  35.  
  36. switch (16){
  37. case 1:
  38. System.out.println("You can not get your drivers license!");
  39. break;
  40. case 16:
  41. System.out.println("You can get your drivers license!");
  42. break;
  43. case 21:
  44. System.out.println("You should have your license by now!);
  45. default:
  46. System.out.println("I don't know what message to put here.");
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement