since Oct 18, 2010

For More

Cows and Likes

Cows

Total received

0

In last 30 days

0

Total given

0

Likes

Total received

0

Received in last 30 days

0

Total given

0

Given in last 30 days

0

Forums and Threads

Scavenger Hunt

Ranch Hand Scavenger Hunt

Greenhorn Scavenger Hunt

that's why im confused because i added it and still no correct total. I did this:

/

/

13 years ago

I was trying to call the method MonthlyInterestRate(interestRate); but for some reason my teacher made it private instead of public so it brings up an error. I don't understand why he did that but i think i'm going to switch it to private and see how that goes.

Ok I did this :

public double MonthlyInterestRate( double annualrate)

{

return annualrate / 12 ;

}

and then this:

// Calculate interest from balance.

interest = balance *= account.MonthlyInterestRate(interestRate);

It gave me the correct interest. But now it didn't add it to my total balance. I'ts still 1, 000. What would cause that when it was working great a minute ago?

Ok I did this :

public double MonthlyInterestRate( double annualrate)

{

return annualrate / 12 ;

}

and then this:

// Calculate interest from balance.

interest = balance *= account.MonthlyInterestRate(interestRate);

It gave me the correct interest. But now it didn't add it to my total balance. I'ts still 1, 000. What would cause that when it was working great a minute ago?

13 years ago

ok i see what you guys are saying. So i guess i'm having trouble getting the interest rate the correct value? should i say :

// Calculate interest from balance.

Balance *= ( and this is where i get a little confused) can you multiply a class method here? Or do i have to well darn i'm confused lol. I know what needs to be done but i can't figure out how to go about doing it no matter how much i stare at that darn textbook!

// Calculate interest from balance.

Balance *= ( and this is where i get a little confused) can you multiply a class method here? Or do i have to well darn i'm confused lol. I know what needs to be done but i can't figure out how to go about doing it no matter how much i stare at that darn textbook!

13 years ago

ok I'm getting this:

But i'm suppose to be getting this:

run:

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.

But i'm suppose to be getting this:

run:

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.

13 years ago

the problem i'm having may be user error since it has to do more with how the interest was calculated. I just can't seem to find a way to fix it. I've been at this for 3 days trying to fix it, but keep it how my teacher wanted it to be. Maybe i'm using a constructor wrong?

13 years ago

I created a SavingsAccount class that's suppose to calculate a monthly interest rate (based off whatever the annual is inputed by user) and then add it to the balance and to a totalInterest accumulator. For some reason my formula keeps dividing instead of multiplying and i can't figure out why? Any ideas?

here's my work:

package assignment06;

/* Design a SavingsAccount class that stores a savings account's annual

* interest and balance.

*

*

}

and here is my TestAccount that i run from:

here's my work:

package assignment06;

/* Design a SavingsAccount class that stores a savings account's annual

* interest and balance.

*

*

}

and here is my TestAccount that i run from:

13 years ago

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]

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]

13 years ago