Placeholder

CIS355A Week 5 Lab File Processing Stocks4U Portfolio Management System

$9.99

Description

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. Anytime you add a stock, you must add it in BOTH places. Anytime you remove a stock, you must remove it in BOTH places.
File—open should prompt for filename using JOptionPane, read the file and populate the JList.
File—save should prompt for filename 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.
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 filename must match class name (DO NOT rename).
SCREENSHOTS
SOLUTION
PAYMENT
The solution includes a zip file.
Attachments [Move over files to preview content of those files]
CIS355A_Week_5_Lab.zip (577.40 KB)
CIS355A-Week-5-Lab-Netbeans-Screenshot.jpg
CIS355A-Week-5-Lab-Report-Screenshot.jpg
CIS355A-Week-5-Lab-Screenshot.png
cis355a_lab_5_report.docx
Java code
Stock.java
StockGUI.java
StockIO.java
Netbeans project
CIS355AWeek5Lab
build
classes
.netbeans_automatic_build
.netbeans_update_resources
Stock.class
StockGUI.class
StockIO.class
build.xml
manifest.mf
nbproject
build-impl.xml
genfiles.properties
private
private.properties
private.xml
project.properties
project.xml
src
Stock.java
StockGUI.java
StockIO.java
stocktest.txt
test
test.txt
Preview Stock.java
}
xxxxxx xxxxx(xxxxxx[] x) {
xxx {
setCompanyName(s[0]); setNumberShares(Integer.parseInt(s[1].trim())); setPurchasePrice(Double.parseDouble(s[3].trim())); setCurrentPrice(Double.parseDouble(s[2].trim())); } catch (Exception e) { throw e; } }
public Stock(String sName, int nShares, double pPrice, double cPrice) { setCompanyName(sName); setNumberShares(nShares);
xxxxxxxxxxxxxxxx(xxxxxx);
xxxxxxxxxxxxxxx(xxxxxx);
}
xxxxxx xxxx xxxxxxxxxxxxxx(xxxxxx xxxxx) {
xxxx.xxxxxxxxxxx = xxxxx;
Preview StockGUI.java
xxxxxx xxxxxxxx() {
xxxxxxxxxxxxxx();
xxxxxxxxxxxx.xxxxxxxx(xxx xxxxxxxxxxxxxxxx());
}
@SuppressWarnings(“unchecked”)
//
//GEN-BEGIN:initComponents
private void initComponents() {

jTextField1 = new javax.swing.JTextField();
tabbedPane = new javax.swing.JTabbedPane();
listTab = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
stockListGUI = new javax.swing.JList<>();
stockInfo = new javax.swing.JLabel();
removeStockButton = new javax.swing.JButton();
xxxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxx();
xxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxx();
xxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxx();
xxxxxxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxxxxxx();
xxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxx();
xxxxxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxxxxxx();
Preview StockIO.java
xxxxxx xxxxx xxxxxxx {
xxxxxxx xxxxxx xxxxxxxx;
xxxxxx xxxxxxx() {
fileName = “”; }
public StockIO(String file) { setFileName(file); }
public ArrayList
getData() throws Exception { BufferedReader br = null; ArrayList
list = new ArrayList
(); try { String line;
xx = xxx xxxxxxxxxxxxxx(xxx xxxxxxxxxx(xxxxxxxx));
xxxxx ((xxxx = xx.xxxxxxxx()) != xxxx) {
xxxxxx[] x = xxxx.xxxxx(“\x”);
xx (x.xxxxxx != 4) {
xxxxx xxx xxxxxxxxx(“xxxxxxx xxxxx, xxxxxx xxxxx xxxx xxxxx xxxx!!!”);
}
Preview Stock.java
}
xxxxxx xxxxx(xxxxxx[] x) {
xxx {
setCompanyName(s[0]); setNumberShares(Integer.parseInt(s[1].trim())); setPurchasePrice(Double.parseDouble(s[3].trim())); setCurrentPrice(Double.parseDouble(s[2].trim())); } catch (Exception e) { throw e; } }
public Stock(String sName, int nShares, double pPrice, double cPrice) { setCompanyName(sName); setNumberShares(nShares);
xxxxxxxxxxxxxxxx(xxxxxx);
xxxxxxxxxxxxxxx(xxxxxx);
}
xxxxxx xxxx xxxxxxxxxxxxxx(xxxxxx xxxxx) {
xxxx.xxxxxxxxxxx = xxxxx;
Preview StockGUI.java
xxxxxx xxxxxxxx() {
xxxxxxxxxxxxxx();
xxxxxxxxxxxx.xxxxxxxx(xxx xxxxxxxxxxxxxxxx());
}
@SuppressWarnings(“unchecked”)
//
//GEN-BEGIN:initComponents
private void initComponents() {

jTextField1 = new javax.swing.JTextField();
tabbedPane = new javax.swing.JTabbedPane();
listTab = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
stockListGUI = new javax.swing.JList<>();
stockInfo = new javax.swing.JLabel();
removeStockButton = new javax.swing.JButton();
xxxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxx();
xxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxx();
xxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxx();
xxxxxxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxxxxxx();
xxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxx();
xxxxxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxxxxxx();
Preview StockIO.java
xxxxxx xxxxx xxxxxxx {
xxxxxxx xxxxxx xxxxxxxx;
xxxxxx xxxxxxx() {
fileName = “”; }
public StockIO(String file) { setFileName(file); }
public ArrayList
getData() throws Exception { BufferedReader br = null; ArrayList
list = new ArrayList
(); try { String line;
xx = xxx xxxxxxxxxxxxxx(xxx xxxxxxxxxx(xxxxxxxx));
xxxxx ((xxxx = xx.xxxxxxxx()) != xxxx) {
xxxxxx[] x = xxxx.xxxxx(“\x”);
xx (x.xxxxxx != 4) {
xxxxx xxx xxxxxxxxx(“xxxxxxx xxxxx, xxxxxx xxxxx xxxx xxxxx xxxx!!!”);
}
Preview stocktest.txt
Apple 100 55.0 80.0 Intel 50 75.0 70.0
xxxxx 50 75.0 70.0
xxxxxx 70 60.0 55.0
Preview test.txt
Netfilx 60 95.0 100.0
Price: $19
Buy Now
Checkout
Added to cart
Buy More Save More
Buy at least TWO items & save up to 30% OFF your ENTIRE order!
Rack up instant rebates in your shopping cart. Simply add items to your cart, and see the savings add up.
Discounts will automatically be applied on eligible orders.
CIS355A Week 5 Lab File Processing Stocks4U Portfolio Management System – $19.00
CIS355A Week 6 Lab Student Management System – $19.00
CIS355A Week 7 Course Project Flooring Application User Manual and Application Code – $25.00
Add to Cart
Checkout
Added to cart
You May Also Like:
CIS355A Entire Course
CIS355A Week 1 Lab Developing an OOP Console Application
CIS355A Week 2 Lab Developing a GUI Application
CIS355A Week 3 Lab BurgersRUs Point of Sale system
CIS355A Week 4 Course Project Flooring Application Analysis and Design
CIS355A Week 4 Lab Stocks4U Portfolio Management System
CIS355A Week 6 Lab Student Management System
CIS355A Week 7 Course Project Flooring Application User Manual and Application Code

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.