Question: This is assignment 2 investment class Create and submit java source code for transforming homework 2 to include arrays or arrays list. classes. One with
This is assignment 2 investment class



Create and submit java source code for transforming homework 2 to include arrays or arrays list. classes. One with the main method and the other as an investment class.
Problem description:
Revise homework 2 by using an array or Array List to track at least 10 different investments. Please use reasonable investment and commission prices. For example, recent of investment price for some of the technology companies are listed below:
| Investment Stock Symbol | Price |
| AAPL | 139.855 |
| MSFT | 64.88 |
| AMZN | 853.66 |
| FB | 136.911 |
| GOOG | 834.7137 |
| GOOGL | 856.8 |
| CMCSA | 37.63 |
| INTC | 35.77 |
| CSCO | 34.47 |
| AMGN | 179.51 |
For the commission rate, it is usually between $5 to $100 at the time of buying or selling:
Make sure that your project consists of at least two classes. One class for the main method (named InvestmentTest) and the other is an investment class. and an Investment class. The InvestmentTest class has a main method and the Investment class consists of the necessary methods and fields for each investment as described below.
The Investment class has the following members:
At least six private fields (instance variables) to store an Investment name and or symbol, number of shares, buying price, selling price, and buying commission and sales commission.
Write set and get methods to access each of the private fields
InvestmentSummary method to print Investment Information including the result of
Create 10 different objects of the investment class and store the objects into an array or an array list.
Create an object of java.util.Scanner to input the information about each investment, one at a time form the keyboard, and track the information in the proper Investment objects by placing calls to the proper set methods for each of the two objects.
When invoking the InvestmentSummary method, use the get method found in the Investment class to access the private members.
Print all investments information including gain or loss using the string %s specifier.
public class Investment t private String investmentName; private int numShares private double buyPrice; private double sellPrice; private double buyComm; private double saleComm; protected void setName (String s investmentName s; protected String getName return investmentName; protected void setshares (int ns) num Shares 2- nS protected int getShares return numShares; protected void setBuyPrice(double bP) buy Price bP; protected double getBuyPrice return buy Price; protected void setSellPrice(double sP) sell Price SP protected double getSellPrice() return sellPrice; protected void setBuyComm(double bC) buy Comm J bC protected double getBuyComm return buy Comm; protected void setSalecomm (double sc) sale Comm sc
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
