Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is the link for week 4 Lab Code. Need to modify the code. https://www.chegg.com/homework-help/questions-and-answers/java-cis355a-week-4-lab-processing-arrays-objects-objectives-create-gui-uses-jlist-jtabbed-q23420490 CIS355A Week 5 LabFile Processing OBJECTIVES Add persistent data storage

Here is the link for week 4 Lab Code. Need to modify the code.

https://www.chegg.com/homework-help/questions-and-answers/java-cis355a-week-4-lab-processing-arrays-objects-objectives-create-gui-uses-jlist-jtabbed-q23420490

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: open, save, exit; and
  • a label to display total portfolio value.

Stock class

  • Modify the toString of Stock class to display as

Company: qty shares (i.e., Apple: 10 shares)

StockIO class

Create a StockIO class that is used to read from and write to a text file using an ArrayList. Make sure to use a delimiter between the fields; it does not have to be the # character. Example format of the file is:

Apple#100#55.0#80.0

Intel#50#75.0#70.0

This class should have two methods.

  • getDatareads data from file, returns data in array list of stock objects
  • saveDatawrites data from an array list to the file in proper format

The file name will be an instance variable that you can set with a parameterized constructor, or with a separate method.

GUI class

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.

Fileopen should prompt for file name using JOptionPane, read the file and populate the JList.

Filesave should prompt for file name to save data from JList to.

Fileexit should exit the program.

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

Output must be look like below.

image text in transcribed

Hile Open Add Stock Save Exit Remove stock Total Value: Input Enter filename stocktest.tt OK Cancel Portofolio Management ikes List Add Stock Apple:100 shares ntel: 50 shares netfilx: 100 shares Intel: Loss of -250.0 Remove stock Total Value: $5250.0

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Analyze the impact of labor unions on health care.

Answered: 1 week ago

Question

Assess three motivational theories as they apply to health care.

Answered: 1 week ago

Question

Discuss the history of U.S. labor unions.

Answered: 1 week ago