Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HotelApp {
  4. boolean cont = true;
  5. Scanner input = new Scanner(System.in);
  6.  
  7. public static void main(String[] args) {
  8. HotelApp myApp = new HotelApp();
  9. myApp.showMenu();
  10. }
  11.  
  12. private void showMenu() {
  13. do {
  14. System.out.println("Select an option");
  15. System.out.println("1. Hotel manager login");
  16. System.out.println("2. Customer login");
  17. String choice = input.nextLine();
  18.  
  19. if (choice.equals("1")) {
  20. System.out.print("Please enter password: ");
  21. input.nextLine();
  22. if (input.nextLine().equals("abc123")) {
  23. System.out.println("Welcome to the hotel app!");
  24. cont = false;
  25. } else {
  26. System.out.println("Please try again!");
  27. }
  28. } else {
  29. System.out.println("That option is unavailable!");
  30. }
  31. } while (cont);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement