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

  Bubble sort and quick sort in ascending order

Quick sort in ascending order, with partition choosing pivot in the middle of the sub-array.

  Create a flowchart to show the process that will allow the

1.create a flowchart to show the process that will allow the implementation of stack push and pop operations.2.create a

  Create a loop to print the days of the week from an array

Create a comment block with the following information: Create an array that contains the days of the week. Create a loop to print the content above.

  Question 1 explain five types of information systems and

question 1. explain five types of information systems and give an example of each.question 2. describe three common

  What-if and goal-seeking analysis

Problem 1: What-if and Goal-seeking analysis, Problem 2: Portfolio Planning using optimization, Problem 3: A Monte Carlo Simulation Problem

  How much time can elapse in the given algorithm

How much time can elapse in Algorithm 16.3 between a crash and its detection? Prove the eventual perfection of Algorithm 16.4. Is the re­ lation mep J.t eventually satisfied in every execution?

  Write a function to insert a node after the head

In a doubly-lined list, each node points to both the next and previous nodes. The info in the each node is an integer and two pointers, one to the previous node and one to the next node - Define the node

  Graph theory

Let  A  be a graph that has an Euler circuit. Prove (or disprove) that all graphs that are isomorphic to  A  have at least on Euler circuit.

  Define the adt priority queue

Generic implementations of priority queue - Apply generic algorithms in solving programming problems, Define and give examples of generic associative containers and Define the ADT Priority Queue

  Create a work plan

Design a dynamic programming algorithm to find the value of the optimal plan. Implement your algorithm using any programming language you prefer. Describe the recurrence relation used by your algorithm at the top of your program or in a separate f..

  Data structures for a single algorithm

Data structures for a single algorithm

  Display the dfs starting from a specified vertex

Design and implement a driver to show the following (check for 2 graphs; 1 is provided, including the starting vertex):Display the dfs starting from a specified vertex;Display the discovery/finishing time for each node in the graph;Show the Parenthes..

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