Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Caculating Compounded interest without double values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Caculating Compounded interest without double values" Watch "Caculating Compounded interest without double values" New topic
Author

Caculating Compounded interest without double values

Shirl Diva
Greenhorn

Joined: Sep 09, 2002
Posts: 21
How would you calculate compound interest without being able to use any double values. There is also a need for an exponential value. How do I accomplish it. Help...anybody...
shirl
Bill Liteplo
Ranch Hand

Joined: Oct 16, 2002
Posts: 88
Why can't you use doubles? What can you use, then? Ints, floats, perhaps Doubles?
Bill
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Shirl,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Bill Liteplo
Ranch Hand

Joined: Oct 16, 2002
Posts: 88
treat all monetary amounts as integral numbers of pennies then, break
the result into its dollar and cents amount, via division and the modulus operator.

OK. That sounds not too bad.

The integer devision to calculate amountInDollars will always truncate.
The modulus operator ('%') will give the remainder.

Bill
Shirl Diva
Greenhorn

Joined: Sep 09, 2002
Posts: 21
Okay, I am going to try this % once again. I can't seem to get to work. It had to be in all ints - I can't use Math.pow without a double value. Thanks though
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Caculating Compounded interest without double values
 
Similar Threads
Program for retirement funds..(STUCK)
Populate Array of type Double from text file
data type for large decimals
getting values from for loop
Ready to give up!