Hi all, first time user on this website and I'm very new to Java so I'm kind of stuck on this I would appreciate any help I can get. My assignment is as follows and I got everything except one last part that I cant figure out how to write it. It deals with the remainder operator.


Write a program (DivideTwo.java) that does the following: allows a user to enter two integers; divides the two; and prints one of two messages based on the result.
IF the first divided by the second is a whole number (remainder is zero) print:
Sample program run
Please enter an integer: 14
Please enter another integer: 7
14 divided by 7 is: 2

Otherwise print:
Sample program run
Please enter an integer: 23
Please enter another integer: 4
23 divided by 4 is: 5 with a remainder of 3
23 divided by 4 is: 5.75

So the part you are having trouble with is the bold section? If it is think about what modulus ( % ) does. It finds the remainder in division. You need the largest whole number that fits, plus the remainder. So, what I would do is create an value that is equal to the remainder

double remainder = (number1 % number2);

That will be your remainder and if you cast number3 to an int

(int) number3

than you have the largest whole number that fits and the remainder.