Lab #17
Maintain customer data
Due Date: Monday of Week 6
20 points
This exercise implements an application to maintain a customer data.
Console
Operation
This application begins by displaying a menu with five choices: list, add, del, help, and exit.- If the user enters list, the application displays the customer data that's stored in a text file.
- If the user enters add, the application prompts the user to enter data for a customer and saves that data to the text file.
- If the user enters del, the application prompts the user for an email address and deletes the corresponding customer from the text file.
- If the user enters help, the application displays the menu again.
- If the user enters exit, the application displays a goodbye message and exits.
Specifications
- Create a class named Customer that stores data for the user's email address, first name, and last name.
- Create interfaces named CustomerReader and CustomerWriter that define the methods that will be used to read and write customer data to a customer file. In addition, create an interface named CustomerConstants that contains three constants that specify the display size of a customer's email address (30), first name (15), and last name (15). Then, create an interface named CustomerDAO that inherits all three of these interfaces.
- Create a class named CustomerTextFile that implements the methods specified by the CustomerDAO interface. Store the customer data in a text file named "customers.txt" in the same directory as this class. If the customers.txt file doesn't exist, this class should create it. This class should use buffered I/O streams, and it should close all I/O streams when they're no longer needed.
- Create a class named DAOFactory that contains a method named getCustomerDAO. This method should return an instance of the CustomerTextFile class.
- Create a CustomerMaintApp class that displays the prompts shown in the console output and accepts the user entries. This class should use the DAOFactory class to get a CustomerDAO object. Then, it should use the methods of the CustomerDAO object to read customer data from the file and to write customer data to the file.
- Use the Validator class or a variation of it to validate the user's entries. Non-empty strings are required for the email address, first name, and last name.
- Use spaces to align the customer data in columns on the console. To do that, you can create a utility class named StringUtils with a method that adds the necessary spaces to a string to reach a specified length.
Option
For this exercise you have the option of creating GUI to maintain the customer data. It's more work, but it will help for the final test. The choice is yours.
- Name of program
- Team's name with all the names of the members (e.g. Team A: John Doe, Jane Smith, etc.)
- Current Date
- Computer system and compiler you are using
- Brief description of the program
Compile and run the Java program.
Take a screen capture by hitting simultaneously the keys Alt and Print Screen (Prt Sc) of the output results (console) and paste it in MS Paint. Save it as a gif file.
When you are ready, upload the java program and the gif file by clicking the link below:I cannot grade if I don't get the files and receive your email.