Lab: File Processing

  
CIS355A Week 5 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.
Sample GUI
                   
 

 
 
RUBRIC
  
Stock class toString modified

5
 
GUI class
· Menu is added.
· Label is added for total portfolio value.
· Open menu item reads data from a file and displays in   list box.
· Save menu item writes data to a text file in proper   format.
· Total value is updated whenever any changes are made to   stocks (add, remove, open a new file).

15
 
StockIO class
· getData method reads from file to array list
· saveData method writes from array list to file

20
 
Code style

5
 
Lab Report

10
 
TOTAL

55
CODE STYLE REQUIREMENTS
· Include meaningful comments throughout your code.
· Use meaningful names for variables.
· Code must be properly indented.
· Include a comment header at beginning of each file, example below.
/****************************************************
Program Name: ProgramName.java
Programmer’s Name: Student Name
Program Description: Describe here what this program will do
***********************************************************/
DELIVERABLES
Submit as a SINGLE zip folder
· all Java files; and
· the Lab report.
Follow assignment specification regarding class/method names.
Note that your Java file name must match class name (DO NOT rename).

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more