Posted on : by : jsmith

$ 29.99

IS355A Week 5 Lab—File Processing


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 user’s data from a text file.


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:


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


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.


Default, no parameter constructor

Constructor that accepts the file name to be written to


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.


File—exit 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.