Question: ### Question 1 a . In the ` Stock ` class, create a field for each of the following ( you choose names ) :

### Question 1
a. In the `Stock` class, create a field for each of the following (you choose names): Stock name, Date of Stock Purchase, Number
of Shares of Stock Purchased, Stock Price at Purchase, and Current Stock Price. Your fields should
ALL be private. The Date of Stock Purchase should be treated as a `String` object.
b. Add `public``get/set` methods to the `Stock` class for each of the fields in part a.
c. Create a `public` default constructor for the `Stock` class that accepts no arguments and sets each of the fields to a default value of your choosing.
d. Create another `public` constructor for the `Stock` class that accepts values for each of your fields and sets all fields to these values.
e. Create a third `public` constructor for the `Stock` class that accepts just the value for stock name. Use this value as the value for the stock name field and set the remaining fields to your default values.
f. Add a `toString` method to your `Stock` class that prints out all information about a `Stock` object in a legible manner.
g. Add a method to your `Stock` class that accepts two values: target value and number of periods
(you name these values whatever you like). The target value is the total value of all shares owned of a particular stock (number of shares owned times price per stock). The original stock investment is the number of shares owned multiplied by the price when stock was purchased. In this method you should calculate the rate of return you would need on the original stock investment to meet the target value in the
number of periods given. This rate should be returned from your method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!