I'm doing an assignment where i have to Design a SavingsAccount class that stores a savings account's annual interest rate and balance. the class constructor should accept the amount of the savings account's starting balance. The class should also have methods for subtracting the amount of withdrawal, add the amount of deposit, and adding the amount of monthly interest to the balance. The monthly interest rate is the annual interest rate divided by 12.
45 minutes ago - 1 week left to answer.
Additional Details
I forgot to mention what my project consisted of: Design a SavingsAccount class that stores a savings account's annual interest rate and balance. the class constructor should accept the amount of the savings account's starting balance. The class should also have methods for subtracting the amount of withdrawal, add the amount of deposit, and adding the amount of monthly interest to the balance. The monthly interest rate is the annual interest rate divided by 12. To add the monthly interest to the balance, multiply the monthly interest rate by the balance, and add the result to the balance. ( this is compound interest ) Use DecimalFormat class to format output.
I'm new at this and i am still trying to grasp the concept of calling methods and the use of constructors. When i run my code this is what happens
Your total deposit is 0.0
Your total withdrawls were 0.0
Your total interest is 0.008333333333333333
Your total balance is $ 1,000.01
Calculate the month 2 (Y/N)
Exception in
thread "main" java.lang.StringIndexOutOfBoundsExceptio…
String index out of range: 0
at java.lang.String.charAt(String.java:686)
at assignment06.testAccount.main(testAccoun…
Java Result: 1
BUILD SUCCESSFUL (total time: 11 seconds)
i'm still not sure exactly what is going wrong . Thanks for your input
[fbr - added code tags]