Question: NEED LAB WEEK 6 ANSWER AND WEEK 5 ANSWER THEY GO TOGETHER. LAB 5 IS BELOW LAB WEEK 6 CIS355A Week 6 LabDatabase Processing OBJECTIVES

NEED LAB WEEK 6 ANSWER AND WEEK 5 ANSWER THEY GO TOGETHER. LAB 5 IS BELOW LAB WEEK 6

CIS355A Week 6 LabDatabase Processing

OBJECTIVES

Add database operations to the Week 5 Stock program.

PROBLEM: Stocks4U Portfolio Management System

The portfolio management system you developed for Stocks4U needs the ability to save and restore a users data from a database

FUNCTIONAL REQUIREMENTS

Create a table in the OmnyBus/EUDPE MySQL database (CIS355A_####) to store the stock information. Include fields for:

Id (int, autoincrement)

Company Name

Number of Shares

Purchase Price

Current Prices

Using the existing Stock4U program, replace the file IO functions with database functions, which

Create a new stock record

Read the entire list of stock records

Update a previously saved stock record

Delete a previously save stock record

Add a JTable to the application.

DataIO Class

Create a DataIO that:

Connects to the database and correct table

Contains methods to

add a stock object to the database

delete a stock object from the database

update a stock object from the database

reads the entire list of stock records and stores the records in an ArrayList

Create a getColumNames method to use as the field names for JTable.

StockList Class

Update the StockList to create pass through methods for each of the list methods:

Get the list of stocks

Add a stock record

Delete a stock record

Update a stock record

Get the columns names for the JTable

Graphical User Interface

Ensure that the existing user interface works as expected, with little or no modification to the presentation class source code.

Add a new tab to the tabbed pane that contains a JTable that will provide a tabular list of all the stock records.

CIS355A Week 5 LabFile Processing

OBJECTIVES

Add persistent data storage to your Week 4 Lab using text file input/output.

PROBLEM: Stocks4U Portfolio Management System

The portfolio management system you developed for Stocks4U needs the ability to save and restore a users data from a text file.

FUNCTIONAL REQUIREMENTS

You can code the GUI by hand or use NetBeans GUI Builder Interface.

You will enhance Week 4 GUI to include

a File menu with menu items

a label to display total portfolio value.

Add file input and output operations

StockIO class

Create a StockIO class that is used to read from and write Stock objects to a text file using an ArrayList.

This class should have the following members:

Constant

DefaultFile name, which holds a default value for the file.

Variables

filename, which is a variable that can be set to point to a different file.

Setter for file name ensuring the file name is not empty, if so, set the file name to the default value.

Constructor

Default, no parameter constructor

Constructor that accepts the file name to be written to

Methods:

writeObjectData, which accepts an arraylist of Stock objects and writes the objects to the named file. The method shall return the number of Stock objects returned.

readObjectData, which determines if the file exists, and if so, reads the Stock objects from the file and stores the objects in an ArrayList, the function then returns the array list.

Both the functions will include appropriate exception handling.

Graphical User Interface

Note that you will need to add an ArrayList to your GUI class to manage the data to/from the file. It will act as a parallel array to your DefaultListModel. Any time you add a stock, you must add it in BOTH places. Any time you remove a stock, you must remove it in BOTH places.

Menus

Fileexit should exit the program.

Stock add menus items that replicate the Add Stock, Clear Stock, and New Stock button operations.

Stock List - add menu items that replicate the Stock List operations, Save Stocks, Clear Stock List, Retrieve Stocks, Update Price, Delete Stock

The total value of the portfolio should be displayed at all times and updated anytime a stock is added or removed.

CIS355A Week 5 LabFile Processing

OBJECTIVES

Add persistent data storage to your Week 4 Lab using text file input/output.

PROBLEM: Stocks4U Portfolio Management System

The portfolio management system you developed for Stocks4U needs the ability to save and restore a users data from a text file.

FUNCTIONAL REQUIREMENTS

You can code the GUI by hand or use NetBeans GUI Builder Interface.

You will enhance Week 4 GUI to include

a File menu with menu items

a label to display total portfolio value.

Add file input and output operations

StockIO class

Create a StockIO class that is used to read from and write Stock objects to a text file using an ArrayList.

This class should have the following members:

Constant

DefaultFile name, which holds a default value for the file.

Variables

filename, which is a variable that can be set to point to a different file.

Setter for file name ensuring the file name is not empty, if so, set the file name to the default value.

Constructor

Default, no parameter constructor

Constructor that accepts the file name to be written to

Methods:

writeObjectData, which accepts an arraylist of Stock objects and writes the objects to the named file. The method shall return the number of Stock objects returned.

readObjectData, which determines if the file exists, and if so, reads the Stock objects from the file and stores the objects in an ArrayList, the function then returns the array list.

Both the functions will include appropriate exception handling.

Graphical User Interface

Note that you will need to add an ArrayList to your GUI class to manage the data to/from the file. It will act as a parallel array to your DefaultListModel. Any time you add a stock, you must add it in BOTH places. Any time you remove a stock, you must remove it in BOTH places.

Menus

Fileexit should exit the program.

Stock add menus items that replicate the Add Stock, Clear Stock, and New Stock button operations.

Stock List - add menu items that replicate the Stock List operations, Save Stocks, Clear Stock List, Retrieve Stocks, Update Price, Delete Stock

The total value of the portfolio should be displayed at all times and updated anytime a stock is added or removed.

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!