Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Java

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 using JTabbedPane.

  • One tab ("Show stocks") should have
    • a JList to display all the stock purchases;
    • a text field or label to display information about a particular stock; and
    • 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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92397222
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question suppose users share a 2 mbps link also suppose

Question : Suppose users share a 2 Mbps link. Also suppose each user transmits continuously at 1 Mbps when transmitting, but each user transmits only 20 percent of the time. When a circuit switching is used, how many use ...

Discuss the importance functionality and role of a

Discuss the importance, functionality, and role of a GateKeeper or VoIP server in a VoIP -deployed network?

You work in a veterinarians office and need to organize the

You work in a Veterinarian's office and need to organize the data on pets that you treat. In your database, you want to keep track of the following information: Customer information: Name Address City State ZIP Phone # Y ...

How to solve this question by using r languageyou can

How to solve this question by using R Language? You can attach the Boston data set in the MASS package. library(MASS) For the Boston data set, we are interested in predicting whether a given suburb has a crime rate above ...

It is just a simple calculator code c language ltstdiohgt

It is just a simple calculator code. C++ language library A) Display on the screen the following menu: Welcome to my calculator Please look at the menu below for your calculations 1. Addition 2. Subtraction 3. Multiplica ...

For the following c statement what is the corresponding

For the following C statement, what is the corresponding RISC-V assembly code? Assume that the variables f, g, h, and i are given and could be considered integers as declared in a C program. Use a minimal number of assem ...

What are content management systems cms describe the

What are Content Management Systems (CMS). Describe the challenges in implementing and maintaining CMS. Can internet search engines be considered as Content Management Systems - explain your answer.

Question what are four important tactical tasks for a

Question: What are four important tactical tasks for a negotiator in a distributive situation to consider? Discuss one instance where you have been involved in distributed bargaining. What was the outcome? The response m ...

Part 1whats the importance of a documentation plan please

Part 1: What's the importance of a Documentation Plan? Please provide an example of a Documentation Plan that you would use. Part 2: How do you calculate how long a project will take? These questions are for my Introduct ...

A shipment of 11 televisions sets contains 4 defective sets

A shipment of 11 televisions sets contains 4 defective sets. A hotel purchases 7 of these televisions sets. a: In how many ways can a hotel purchase 7 and receive 2 of the defective sets? b: What is the probability that ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As