Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. //This is to give error if your input is wrong.
  2.  
  3. @SuppressWarnings("empty-statement")
  4. public static void main(String[] args) {
  5. System.out.println("Hi and welcome to Green Lawn Properties please input the following!");
  6.  
  7. Scanner olivier = new Scanner(System.in);
  8.  
  9. System.out.println("What's the building number?");
  10. int building = olivier.nextInt();
  11. if ((building <= 0) || (building >= 16))
  12. {
  13. System.out.println("Error 404 wrong building #.");
  14. return;
  15. }
  16.  
  17. System.out.println("What's the apartment number?");
  18. int apartment = olivier.nextInt();
  19. if ((apartment <= 100) || (apartment >= 1513));
  20. {
  21. System.out.println("Error 404 wrong apartment #.");
  22. return;
  23. }
  24. System.out.println("What's the month number?");
  25. int month = olivier.nextInt();
  26. if ((month < 0) || (month > 12))
  27. {
  28. System.out.println("Error 404 wrong month #.");
  29. return;
  30. }
  31. System.out.println("What is your floor number?");
  32. int floor = olivier.nextInt();
  33. if ((floor < 0) || (floor > 4))
  34. {
  35. System.out.println("Error 404 wrong floor #.");
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement