Advertisement
Guest User

Untitled

a guest
Sep 10th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Menus {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         int value;
  8.         String userName;
  9.         String password;
  10.         boolean a = true;
  11.  
  12.         Scanner sc = new Scanner(System.in);
  13.  
  14.         while (a) {
  15.  
  16.             displayMenu();
  17.             value = sc.nextInt();
  18.             switch (value) {
  19.             case 1:
  20.                 System.out.println("Username :");
  21.                 userName = sc.next();
  22.                 System.out.println("Password :");
  23.                 password = sc.next();
  24.  
  25.                 if (userName.equals("admin") && password.equals("admin")) {
  26.                     displaySuperMenu();
  27.                 }
  28.                
  29.                
  30.                
  31.  
  32.                 a = false;
  33.                 break;
  34.             case 2:
  35.                 System.out.println("Exit selected");
  36.                 a = false;
  37.                 break;
  38.             default:
  39.                 System.out.println("Invalid selection! \n" + "==================");
  40.  
  41.             }
  42.  
  43.         }
  44.  
  45.     }
  46.  
  47.     public static void displayMenu() {
  48.         System.out.println(" Options: ");
  49.         System.out.println(" 1. Login ");
  50.         System.out.println(" 2. Exit  ");
  51.         System.out.println(" Select option: ");
  52.     }
  53.  
  54.     public static void displaySuperMenu() {
  55.         System.out.println(" Options: ");
  56.         System.out.println(" A. CREATE ");
  57.         System.out.println(" B. VIEW ");
  58.         System.out.println(" C. DELETE ");
  59.         System.out.println(" D. UPDATE \n" + "==================");
  60.         System.out.println(" Select option: ");
  61.     }
  62.    
  63.     public static void elevatedMenu() {
  64.         System.out.println("");
  65.     }
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement