Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is from Murach Java programming Project. Including NetBeans instructions will also be very helpful, thanks so much. Console Welcome to the Customer Maintenance application

This is from Murach Java programming Project. Including NetBeans instructions will also be very helpful, 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: test@gm'ail.com

Enter first name: text

Enter last name: test

text test was added to the database.

Enter a command: list

CUSTOMER LIST

frank46@hotmail.com Frank Jones

sarah_smith@yahoo.com Sarah Smith

test@gm'ail.com text test

Enter a command: del

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

text test was deleted from the database.

Enter a command: list

CUSTOMER LIST

frank46@hotmail.com Frank Jones

sarah_smith@yahoo.com Sarah Smith

Enter a command: exit

Bye.

Operation

This application will present a user with five choices: list, add, delete, help, and exit.

Menu choices may be used, but buttons are typically used.

If the user chooses list, the application displays the customer data thats stored in a text or XML file for persistent storage.

If the user chooses add, the application prompts the user to enter data for a customer and saves that data to the persistent storage.

If the user chooses delete, the application prompts the user for an email address and deletes the corresponding customer from the persistent storage.

If the user chooses help, the application displays the usage information.

If the user chooses 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.

Create interfaces named CustomerReader and CustomerWriter that define the methods that will be used to read and write customer data to persistent storage In addition, create an interface named CustomerConstants that contains three constants that specify the display size of a customers email address (30), first name (15), and last name (15). Then, create an interface named CustomerDAO that inherits all three of these interfaces.

Create at least one persistence class that implements the methods specified by the CustomerDAO interface. Store the customer data. If you use a text or XML file which doesn't exist, this class should create it.

Create a class named DAOFactory that contains a method named getCustomerDAO. This method should return an instance of the persistence class.

Create a CustomerMaintApp class that controls execution. 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 and write customer data to the persistent storage.

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.

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.

Add an update command that lets the user update an existing customer. This command should prompt the user to enter the email address. Then, it should let the user update the first name or 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.

MurachDBCreate SQL File

CONNECT 'jdbc:derby:MurachDB;create=true';

CREATE TABLE Products ( ProductCode VARCHAR(10), Description VARCHAR(50), Price DOUBLE );

INSERT INTO Products VALUES ('bvbn', 'Murach''s Beginning Visual Basic .NET', 49.5); INSERT INTO Products VALUES ('cshp', 'Murach''s C#', 49.5);

INSERT INTO Products VALUES ('java', 'Murach''s Beginning Java 2', 49.5);

INSERT INTO Products VALUES ('jsps', 'Murach''s Java Servlets and JSP', 49.5);

INSERT INTO Products VALUES ('mcb2', 'Murach''s Mainframe COBOL', 59.5);

INSERT INTO Products VALUES ('sqls', 'Murach''s SQL for SQL Server', 49.5);

INSERT INTO Products VALUES ('zjcl', 'Murach''s OS/390 and z/OS JCL', 62.5);

CREATE TABLE Customers ( CustomerID INT, FirstName VARCHAR(50), LastName VARCHAR(50), EmailAddress VARCHAR(50) );

INSERT INTO Customers VALUES (3, 'John', 'Smith', 'johnsmith@hotmail.com'); INSERT INTO Customers VALUES (4, 'Frank', 'Jones', 'frankjones@yahoo.com');

INSERT INTO Customers VALUES (5, 'Cynthia', 'Green', 'seagreen@levi.com');

INSERT INTO Customers VALUES (6, 'Wendy', 'Kowolski', 'wendyk@warners.com');

CREATE TABLE Invoices ( InvoiceID INT, CustomerID INT, InvoiceNumber VARCHAR(50), InvoiceDate DATE, InvoiceTotal DOUBLE );

INSERT INTO Invoices VALUES (1, 3, '10500M', '2004-10-25', 495.0);

INSERT INTO Invoices VALUES (2, 4, '10501M', '2004-10-25', 59.5);

INSERT INTO Invoices VALUES (4, 5, '10502M', '2004-10-25', 99.0);

INSERT INTO Invoices VALUES (5, 6, '10503M', '2004-10-25', 112.0);

INSERT INTO Invoices VALUES (6, 4, '10504M', '2004-11-18', 99.0);

INSERT INTO Invoices VALUES (7, 3, '10505M', '2004-11-18', 297.5);

CREATE TABLE LineItems ( LineItemID INT, CustomerID INT, ProductCode VARCHAR(10), Quantity INT );

INSERT INTO LineItems VALUES (1, 1, 'java', 5); INSERT INTO LineItems VALUES (2, 1, 'jsps', 5);

INSERT INTO LineItems VALUES (3, 2, 'mcb2', 1);

INSERT INTO LineItems VALUES (7, 4, 'cshp', 1);

INSERT INTO LineItems VALUES (8, 4, 'zjcl', 2);

INSERT INTO LineItems VALUES (9, 6, 'sqls', 1);

INSERT INTO LineItems VALUES (10, 6, 'java', 1);

INSERT INTO LineItems VALUES (11, 7, 'mcb2', 5);

DISCONNECT;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions