aspose file tools*
The moose likes Beginning Java and the fly likes Modulus Operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Modulus Operator" Watch "Modulus Operator" New topic
Author

Modulus Operator

Shirl Diva
Greenhorn

Joined: Sep 09, 2002
Posts: 21
Can anyone give me some insight on Java's modulus operator? If I have code that calculates the interest on the principal amount, why can't I get
the remainder for the division ( I am using all integer values) statement. I am new to java and have been grasping at straws a bit. I seem to be able to get the first digit but not the second one - for the cents. On second thought, can you take a look at the code and let me know where I'm going wrong:

Maybe I don't really understand the modulus operator. I thought that you could divide
2 integers then use the same two to get the
remainder. Please help.
Shirl

Marilyn added code tags.
[ October 31, 2002: Message edited by: Marilyn de Queiroz ]
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1740
    
    2
Closing thread in IDEs and moving to Java in General (Beginner).
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

where is the modulus operator in your code???
Jamie
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
This page might help explain modulo.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Modulus Operator
 
Similar Threads
Modulus Operator
Caculating Compounded interest without double values
Generating compound interest with integers
Sum the digits of an integer.
Use of Math.pow?