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

  Describe an efficient algorithm based on dynamic programming

At the end of its fifth successful season, some premier league is planning to give an award to the Most Improved Batsman over the five years. For this, an Improvement Index will be computed for each batsman. This is defined as the longest sequence..

  Why are symbolic constants usually a better choice

Why are symbolic constants usually a better choice than literal constants? Why are const symbolic constants usually a better choice than #defined symbolic constants?

  Explain two possible solution-fill in blank squares by words

The objective is to fill in blank squares using words from the list. Your task is to formulate problem as constraint satisfaction problem. Explain two possible solutions.

  Use advanced data structures and support sorting

Extend Project 1 to use advanced data structures and support sorting on various keys. The project will be graded according the criteria for the final project - see below.

  Disadvantages for allocating the stack starting at prog

What are the advantages/disadvantages for allocating the stack starting at PROG. For step 1, does accessing the stack using index mode change the SP, What are some advantages/disadvantages for accessing the stack data this way

  Question related to sequential files

In spite of the fact that sequential files lack direct targeted addressing of each of the records and fields, they are the most widely used.

  Create a solution algorithm using pseudocode

Algorithm that will receive two integer items from a terminal operator, and display to the screen their sum, difference, product and quotient.

  Display rep and contact as the headings in the two columns

Display Rep and Contact as the headings in the two columns of concatenated field data.

  Compute the memory required by array

Compute the memory required by array and linked list to store exactly 10 nodes. Note that the linked list requires head pointer too.

  Find the minimum cost path from a designated node

Find the Minimum Cost Path from a designated start node to a designated destination node in a graph.

  Draw a defining diagram

Draw a defining diagram (IPO). Draw a structure chart. Write a program using pseudocode and modularization

  Design a representation of display screen

Create a form that lists possible potatoes and toppings in a manner that is easy for counter servers and kitchen crew to scan, and can also be used as input for the inventory reorder system.

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