Create a stock class to manage the stock activity

Assignment Help Data Structure & Algorithms
Reference no: EM131214145

Lab-Processing Arrays of Objects

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 usingJTabbedPane.

• 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.

Reference no: EM131214145

Questions Cloud

For the circuit of given figure find vab : For the circuit of given figure, find Vab if (a) k = 0 and (b) k = 0.01. -  Do not use network theorems to simplify the circuit prior to solution.
Difference in antisocial and borderline personality disorder : Discuss the similarities and differences between antisocial personality disorder and borderline personality disorder. What are the practice implications of these two disorders for forensic mental health professionals? Why do you think that substan..
What assumption is the prosecutor making : The prosecutor concludes that the probability that a student is wearing both Duke sweatpants and a UNC sweatshirt is 2% (0.1*0.2 = 0.02), which is large enough to cause reasonable doubt for the jury, so they don't convict him. What assumption is t..
What is the probability that the student : Suppose that a certain college class contains 40 students. Of these 26 are juniors, 27 are history majors, and 10 are neither. A student is selected at random from the class. (a) What is the probability that the student is both a junior and a histo..
Create a stock class to manage the stock activity : Create a Stock class to manage the stock activity. It should have private instance variables of company name. Create a get method to calculate and return the profit or loss. This would be calculated as Number of shares * (current price - purchase pri..
What strategies would you recommend to mitigate : What strategies would you recommend to mitigate the negative aspects of aging? What have you learned from this assignment and the text about the positive aspects of aging?
Determining the human population : According to the American Red Cross, approximately 10% of the human population is blood type B-positive. If we select 20 people at random, find the probability that more than 3 people in the sample have blood type B-positive. Is this unusual?
How to minimize these threats : Consider the Stay Home Online Rentals case study discussed in Chapter 5. Produce a report for the Director of the company outlining the threats that may exist for its database system, and provide a set of recommendations on how to minimize these t..
What height represents the first quartile : In a survey of men in a certain country (ages 20-29), the mean height was 66.5 inches with a standard deviation of 2.9 inches. a) What height represents the 80th percentile? b) What height represents the first quartile?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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