Look at the code that assigns a value to the variable: interest
What happens to the value: (annualInterest/12) before it is assigned to interest?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Look at the code that assigns a value to the variable: interest
What happens to the value: (annualInterest/12) before it is assigned to interest?
If you don't understand my answer, don't ignore it, ask a question.
It's stated as a int?
What happens to 0.004 when it is converted to an int?
If you don't understand my answer, don't ignore it, ask a question.
Doesn't it round down to 0? So it has to be double?
0.004 is a double and doesn't need to be cast to double.
If you don't understand my answer, don't ignore it, ask a question.
Okay, well I'm not sure what I'm suppose to see.
I don't understand your last post. What does "suppose to see" mean?
Do you know what is causing interest to be zero?
Do you know how to change the code to keep interest from being zero?
If you don't understand my answer, don't ignore it, ask a question.
No to both of those questions, sorry..
What did you mean in post#29? "round down to 0"
Do some experimenting with casting double values to int to see what happens. Write a short test program with this statement. Compile and execute it:
Change the 4.3 to different double values to see what happensSystem.println((int)4.3); // see what cast to int does
If you don't understand my answer, don't ignore it, ask a question.
No idea what to do man, sorry. I might just go skip this assignment.
Do you know how to write a small program for testing a statement?
If you don't understand my answer, don't ignore it, ask a question.