Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Menus {
- public static void main(String[] args) {
- int value;
- String userName;
- String password;
- boolean a = true;
- Scanner sc = new Scanner(System.in);
- while (a) {
- displayMenu();
- value = sc.nextInt();
- switch (value) {
- case 1:
- System.out.println("Username :");
- userName = sc.next();
- System.out.println("Password :");
- password = sc.next();
- if (userName.equals("admin") && password.equals("admin")) {
- displaySuperMenu();
- }
- a = false;
- break;
- case 2:
- System.out.println("Exit selected");
- a = false;
- break;
- default:
- System.out.println("Invalid selection! \n" + "==================");
- }
- }
- }
- public static void displayMenu() {
- System.out.println(" Options: ");
- System.out.println(" 1. Login ");
- System.out.println(" 2. Exit ");
- System.out.println(" Select option: ");
- }
- public static void displaySuperMenu() {
- System.out.println(" Options: ");
- System.out.println(" A. CREATE ");
- System.out.println(" B. VIEW ");
- System.out.println(" C. DELETE ");
- System.out.println(" D. UPDATE \n" + "==================");
- System.out.println(" Select option: ");
- }
- public static void elevatedMenu() {
- System.out.println("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement