Class ShowCustomer
java.lang.Object
bcu.cmp5332.bookingsystem.commands.ShowCustomer
- All Implemented Interfaces:
Command
The ShowCustomer class represents a command to display details of a specific customer.
It implements the Command interface, allowing it to be executed within the context of a FlightBookingSystem instance.
Upon execution, the command retrieves the customer information by their ID from the provided FlightBookingSystem instance. It then invokes the showDetails() method of the Customer class to display the details of the customer.
Example usage:
// Create a new ShowCustomer command instance for customer with ID 101
Command showCustomerCommand = new ShowCustomer(101);
// Execute the command within a FlightBookingSystem instance
showCustomerCommand.execute(flightBookingSystem);
-
Field Summary
Fields inherited from interface bcu.cmp5332.bookingsystem.commands.Command
HELP_MESSAGE
-
Constructor Summary
ConstructorDescriptionShowCustomer
(int id) Constructs a ShowCustomer command object with the specified customer ID. -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(FlightBookingSystem flightBookingSystem) Executes the show customer details command within the provided FlightBookingSystem instance.
-
Constructor Details
-
ShowCustomer
public ShowCustomer(int id) Constructs a ShowCustomer command object with the specified customer ID.- Parameters:
id
- The ID of the customer whose details are to be displayed
-
-
Method Details
-
execute
Executes the show customer details command within the provided FlightBookingSystem instance. Retrieves the customer information by their ID and displays their details using the showDetails() method.- Specified by:
execute
in interfaceCommand
- Parameters:
flightBookingSystem
- The FlightBookingSystem instance on which the command is executed- Throws:
FlightBookingSystemException
- If there is an error while accessing or processing flight booking system data
-