Create a stockio class that is used to write to a text file

Assignment Help Computer Engineering
Reference no: EM131230422

Lab-File 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 user's 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.

· getData-reads data from file, returns data in array list of stock objects
· saveData-writes 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.

File-open should prompt for file name using JOptionPane, read the file and populate the JList.
File-save should prompt for file name to save data from JList to.
File-exit 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.

Reference no: EM131230422

Describes the problem being address

Complete a problem analysis that describes the problem being address, and the benefit this system will have for the coaches and administration of the college. When you make

Write a program that reads 100 numbers

design a program in python that continually reads in numbers from the user and adds them together until the sum reaches 100. Write another program that reads 100 numbers fro

Give utilization of the cpu for the given two processes

Two real-time methods are running on a computer. The first one runs every 25 msec for 10 msec. The second one runs every 40 msec for 15 msec. What is the utilization of the

Find a set of criteria for assessment of video clips

find a set of criteria for assessment of video clips suitable for inclusion in Multimedia presentations over the web. Discuss your choices and where they differ from choices

Plan a use case diagram to represent actors

As Dewey Dezmal enters high-ceilinged, wood-paneled reading room of the Ruminski Public Library, a young woman, seated at a long, oak table, pokes her head out from behind t

Methods to target certain audience

Recognize a particular website which you frequently go to and explain the targeted audience which visit that particular site. Provide explanation how the site is developed f

Describe in detail how you would apply the techniques

Suppose that you are the analyst charged with developing a new system. What requirements gathering techniques will you use? Describe in detail how you would apply the techniqu

Write down a not so bad cardiac simulator

The user has to be prompted to type in a 3 digit number, and then the program should print to the screen whatever the CARDIAC Instruction Decoder box would show had that bee

Reviews

Write a Review

 
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd