Question: This is from Murach Java programming Project. NetBeans Instructions will also be very helpfu, Thanks so much. Console Welcome to the Customer Maintenance application COMMAND

This is from Murach Java programming Project. NetBeans Instructions will also be very helpfu, Thanks so much.

Console

Welcome to the Customer Maintenance application

COMMAND MENU

list - List all customers

add - Add a customer

del - Delete a customer

help - Show this menu

exit - Exit this application

Enter a command: list

CUSTOMER LIST

frank46@hotmail.com Frank Jones

sarah_smith@yahoo.com Sarah Smith

Enter a command: add

Enter customer email address: xml_test@gm'ail.com

Enter first name: XML

Enter last name: Test

XML Test was added to the database.

Enter a command: list

CUSTOMER LIST

frank44@hotmail.com Frank Jones

sarah_smith@yahoo.com Sarah Smith

xml_test@gm'ail.com XML Test

Enter a command: del

Enter customer email to delete: xml_test@gm'ail.com

XML Test was deleted from the database.

Enter a command: list

CUSTOMER LIST

frank44@hotmail.com Frank Jones

sarah_smith@yahoo.com Sarah Smith

Enter a command: exit

Bye.

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 thats stored in an XML file.

If the user enters add, the application prompts the user to enter data for a customer and saves that data to the XML file.

If the user enters del, the application prompts the user for an email address and deletes the corresponding customer from the XML 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 users email address, first name, and last name.

Use a text editor to create an XML file named customers.xml in the same directory as the Customer class. This file should contain valid XML tags for at least one customer. For example:

Frank Jones

Create a class named CustomerXMLFile that reads the customers.xml file when its instantiated. This class should include a public method that return an array list of Customer objects created from the data in the file, a public method that returns a Customer object for a specified email address, and public methods for adding and deleting records. Include any additional private methods that you need to perform these functions.

Create a CustomerMaintApp class that works as shown in the console output. This class should use the Customer and CustomerXMLFile classes to work with Customer data.

Use spaces to align the customer data in columns on the console. To do that, you can create a utility class named StringUtils that has a method that adds the necessary spaces to a string to reach a specified length.

Use the Validator class or a variation of it to validate the users entries. Non-empty strings are required for the email address, first name, and last name.

Add an update command that lets the user update an existing customer. This command should prompt the user to enter the email address for a customer. Then, it should let the user update the first name and last name for the customer.

Add a method to the Validator class that uses string parsing techniques to validate the email address. At the least, you can check to make sure that this string contains some text, followed by an @ sign, followed by some more text, followed by a period, followed by some more text. For example, x@x.x would be valid while xxx or x@x would not.

Use an interface to eliminate any direct calls to the CustomerXMLFile class from the CustomerMaintApp class. To do that, you can use CustomerReader, CustomerWriter, CustomerConstants, and CustomerDAO interfaces as well as a DAOFactory class as described in project 19-3. Then, you can modify the CustomerXMLFile and CustomerMaintApp classes so they use these interfaces and class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!