Results 1 to 5 of 5
- 04-14-2011, 03:15 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 2
- Rep Power
- 0
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.
Term Rate
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?
- 04-14-2011, 03:24 AM #2
Yes we can help. No we won't do it for you. Do not dump your assigment on us and expect us to do it. You have to write the code. When your get stuck post your code, error messages and ask a specific question.
- 04-14-2011, 03:28 AM #3
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
I'm sure a lot of people can help you.
You need to put the effort in first, don't just dump the assignment. Let's see your first attempts, tell us what is giving you a hard time and ask specific questions. If you get errors, copy and paste them, do not paraphrase.
Finally, use code tags when posting code. To do this wrap your code in code tags.
[code ]
YOUR CODE HERE
[/code]
- 04-19-2011, 10:02 PM #4
Member
- Join Date
- Apr 2011
- Posts
- 2
- Rep Power
- 0
Im not a 100% sure but if you could tell me if I am doing it right?
public class CD
{
private int y = 0;
private int p = 0;
private int r = 0;
private int product;
public CD( int Year, int Price,);
{
y = year;
p = price;
r = rate
}
public void setYear(int Year)
{
y = year;
}
public int getYear()
{
return y;
}
public void setPrice( int Price)
{
p = price;
}
public int getPrice()
{
return p;
}
public int getRate()
{
if (y = 1)
{
r = .3;
}
else if (y = 2)
{
r =.45;
}
else if (y = 3)
{
r = .95;
}
else if (y = 4)
{
r = 1.5;
}
else if (y = 5)
{
r = 1.8;
}
else
{
- 04-20-2011, 12:17 AM #5
Similar Threads
-
Temporarily add CA certificate
By ohm in forum Advanced JavaReplies: 0Last Post: 02-15-2011, 12:07 PM -
Unwrapping a key using a certificate
By alexag in forum New To JavaReplies: 0Last Post: 12-15-2010, 12:40 PM -
SUN 310-813 certificate
By koko12 in forum Java CertificationReplies: 2Last Post: 11-24-2009, 05:33 PM -
HTTPS using certificate
By MCJP in forum Advanced JavaReplies: 1Last Post: 09-25-2008, 01:48 PM -
Java certificate
By Nick15 in forum Java CertificationReplies: 2Last Post: 11-12-2007, 06:02 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks