Package trial.gaurav.console
Class CustomerConsoleManager
java.lang.Object
trial.gaurav.console.CustomerConsoleManager
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor for `CustomerConsoleManager` to ensure singleton pattern. -
Method Summary
Modifier and TypeMethodDescriptionCollects customer details from the console.intCollects the customer ID from the console.voidDisplays the customer details on the console.static CustomerConsoleManagerReturns the singleton instance of `CustomerConsoleManager`.
-
Field Details
-
scanner
-
INSTANCE
-
-
Constructor Details
-
CustomerConsoleManager
Private constructor for `CustomerConsoleManager` to ensure singleton pattern.- Parameters:
sc- The scanner object to read user inputs from the console.
-
-
Method Details
-
getInstance
Returns the singleton instance of `CustomerConsoleManager`.- Returns:
- The singleton instance of `CustomerConsoleManager`.
-
collectCustomerDetails
Collects customer details from the console.- Specified by:
collectCustomerDetailsin interfaceCustomerRecordIo- 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:
collectCustomerIdin interfaceCustomerRecordIo- Returns:
- The customer ID entered by the user.
-
display
Displays the customer details on the console.- Specified by:
displayin interfaceCustomerRecordIo- Parameters:
customer- The `Customer` object containing the customer details to be displayed.
-