not sure about how to right a Certificate Deposit class
Create a class named CD to represent the certificate of deposit. It should store the following attributes (data):
The term (or duration) of the CD in years
The purchase price of the CD
Both of these attributes are known when a CD is purchased. In your program assume that they never change after the CD is purchased. This means that they should be set through a constructor only (no "setter" accessor methods; no public data members).
The class should provide a method named getRate() that returns the interest rate. The interest rate is determined by the term of the CD according to this table.
1 year 0.30%
2 years 0.45%
3 years 0.95%
4 years 1.50%
5 years 1.80%
Because the interest rate is calculated by the CD class based on the term, there should be no setRate() method in the class. Also, there should be no class member variable to store the interest rate.
In your constructor, if the number of years provided is less than one, set the value to one. If years is greater than five, then set it to five.
Can anybody help me?