Class CustomerConsoleManager

java.lang.Object
trial.gaurav.console.CustomerConsoleManager
All Implemented Interfaces:
CustomerRecordIo

public class CustomerConsoleManager extends Object implements CustomerRecordIo
The `CustomerConsoleManager` class provides methods to interact with the console and collect customer details from the user. It implements the `CustomerRecordIo` interface to handle customer record input and output operations.
  • Field Details

  • Constructor Details

    • CustomerConsoleManager

      private CustomerConsoleManager(Scanner sc)
      Private constructor for `CustomerConsoleManager` to ensure singleton pattern.
      Parameters:
      sc - The scanner object to read user inputs from the console.
  • Method Details

    • getInstance

      public static CustomerConsoleManager getInstance()
      Returns the singleton instance of `CustomerConsoleManager`.
      Returns:
      The singleton instance of `CustomerConsoleManager`.
    • collectCustomerDetails

      public Customer collectCustomerDetails()
      Collects customer details from the console.
      Specified by:
      collectCustomerDetails in interface CustomerRecordIo
      Returns:
      A `Customer` object containing the customer details entered by the user.
    • collectCustomerId

      public int collectCustomerId()
      Collects the customer ID from the console.
      Specified by:
      collectCustomerId in interface CustomerRecordIo
      Returns:
      The customer ID entered by the user.
    • display

      public void display(Customer customer)
      Displays the customer details on the console.
      Specified by:
      display in interface CustomerRecordIo
      Parameters:
      customer - The `Customer` object containing the customer details to be displayed.