Class ShowCustomer

java.lang.Object
bcu.cmp5332.bookingsystem.commands.ShowCustomer
All Implemented Interfaces:
Command

public class ShowCustomer extends Object implements 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);
 
See Also:
  • Field Summary

    Fields inherited from interface bcu.cmp5332.bookingsystem.commands.Command

    HELP_MESSAGE
  • Constructor Summary

    Constructors
    Constructor
    Description
    ShowCustomer(int id)
    Constructs a ShowCustomer command object with the specified customer ID.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(FlightBookingSystem flightBookingSystem)
    Executes the show customer details command within the provided FlightBookingSystem instance.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public void execute(FlightBookingSystem flightBookingSystem) throws FlightBookingSystemException
      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 interface Command
      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