0% found this document useful (0 votes)
18 views1 page

Admin - Java ABR

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Admin - Java ABR

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

class Admin extends User {

// Constructor for Admin class


public Admin(int userId, String username, String password) {
super(userId, username, password); // Call the parent constructor to set
user details
}

@Override
public void handleActions() {
// Admin-specific actions menu
while (true) {
System.out.println("Welcome, Admin!");
System.out.println("1. Add a new flight");
System.out.println("2. View all flights");
System.out.println("3. Log out");
System.out.print("Choose an option: ");
int choice = AerowayBookingSystem.scanner.nextInt();
AerowayBookingSystem.scanner.nextLine(); // consume newline

// Switch to perform actions based on the Admin's choice


switch (choice) {
case 1:
AerowayBookingSystem.addFlight(); // Calls the addFlight method
in AerowayBookingSystem class
break;
case 2:
AerowayBookingSystem.viewFlights(); // Calls the viewFlights
method in AerowayBookingSystem class
break;
case 3:
System.out.println("Logging out...");
return; // Exit the loop and log out
default:
System.out.println("Invalid choice.");
}
}
}
}

You might also like