CIS355A Week 4 Lab – Processing Arrays of Objects Stocks4U

$ 12

CIS355A Week 4 Lab – Processing Arrays of Objects Stocks4U

OBJECTIVES
• Create a GUI that uses JList and JTabbedPanes.
• Process multiple objects in an ArrayList.
• Code event handlers for multiple events.

PROBLEM: Stocks4U Portfolio Management System
Stocks4U needs to develop an app for you to manage your stock purchases. You should be able to store a list of stock purchases, view the individual stocks, add and remove stocks.

FUNCTIONAL REQUIREMENTS
You can code the GUI by hand or use NetBeans GUI builder interface.

The GUI should have two tabs using JTabbedPane.
• One tab (“Show stocks”) should have
o a JList to display all the stock purchases;
o a text field or label to display information about a particular stock; and
o a JButton to remove a stock.
• One tab (“Add stock”) should have textboxes, labels, and a button to input a stock.

Create a Stock class to manage the stock activity. It should have private instance variables of
• company name;
• number of shares;
• purchase price; and
• current price.
Create a default and parameterized constructor.
Create sets/gets for all instance variables.
Create a get method to calculate and return the profit or loss. This would be calculated as
Number of shares * (current price – purchase price).
Create toString to display the name of the stock.

As you add stocks, they are displayed in the JList.
If you select an element in the JList, the gain or loss is displayed in the label or text field.
If you select an element in the JList and click Remove, the stock is removed from the list.

GRADING RUBRIC
Stock class
• Has all required functionality 15
GUI class
• Use the Stock class to process data.
• As you add stocks, they are displayed in the JList.
• If you select an element in the JList, the gain or loss is displayed in the label or text field.
• If you select an element in the JList and click Remove, the stock is removed from the list.
• Use error messages for any invalid/missing user input using JOptionPane. 25
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
• Lab report

Follow assignment specification regarding class/method names.
Note that your java filename must match class name (DO NOT rename).

998 in stock

SKU: CIS355AWEEK4LAB Category:

Description

CIS355A Week 4 Lab – Processing Arrays of Objects Stocks4U

OBJECTIVES
• Create a GUI that uses JList and JTabbedPanes.
• Process multiple objects in an ArrayList.
• Code event handlers for multiple events.

PROBLEM: Stocks4U Portfolio Management System
Stocks4U needs to develop an app for you to manage your stock purchases. You should be able to store a list of stock purchases, view the individual stocks, add and remove stocks.

FUNCTIONAL REQUIREMENTS
You can code the GUI by hand or use NetBeans GUI builder interface.

The GUI should have two tabs using JTabbedPane.
• One tab (“Show stocks”) should have
o a JList to display all the stock purchases;
o a text field or label to display information about a particular stock; and
o a JButton to remove a stock.
• One tab (“Add stock”) should have textboxes, labels, and a button to input a stock.

Create a Stock class to manage the stock activity. It should have private instance variables of
• company name;
• number of shares;
• purchase price; and
• current price.
Create a default and parameterized constructor.
Create sets/gets for all instance variables.
Create a get method to calculate and return the profit or loss. This would be calculated as
Number of shares * (current price – purchase price).
Create toString to display the name of the stock.

As you add stocks, they are displayed in the JList.
If you select an element in the JList, the gain or loss is displayed in the label or text field.
If you select an element in the JList and click Remove, the stock is removed from the list.

GRADING RUBRIC
Stock class
• Has all required functionality 15
GUI class
• Use the Stock class to process data.
• As you add stocks, they are displayed in the JList.
• If you select an element in the JList, the gain or loss is displayed in the label or text field.
• If you select an element in the JList and click Remove, the stock is removed from the list.
• Use error messages for any invalid/missing user input using JOptionPane. 25
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
• Lab report

Follow assignment specification regarding class/method names.
Note that your java filename must match class name (DO NOT rename).

Reviews

There are no reviews yet.

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