Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions