Why were the innermost set of parentheses used in the statement:
System.out.println("The original : " + (quotient*3 + remainder) );
Answer:
The parentheses force evaluation of the entire arithmetical expression
(quotient*3 + remainder).
Then the result is converted to characters and appended to the string.
Without the parentheses, the subexpressions are evaluated independently,
converted to characters, and appended to the string.
Taking an Integer Apart
The integer division operator / and the remainder operator %
take an integer apart.
theInteger / divisorquotient theInteger % divisor
remainder
The original integer can be put back together again:
quotient * divisor + remaindertheInteger
In many calculations, it is convenient to do everything with integers,
so both / and % are needed.
QUESTION 15:
If you exchange 372 pennies for dollar bills, how many bills do you get? How many pennies are left over?
quotient
theInteger % divisor