Notes for chapter 9B Expressions and Arithmetic Operators _________
What are some operators in Java? _______________________________
In the equation:
-23 - 3
Which number is negated? ____
Which number is subtracted? _____
Which of these equations are correct? (Put a check mark next to expressions that are correct)
Expression
Correct or Not Correct?
Expression
Corrector Not Correct?
25
25 - value
2( a - b )
(a-b) * (c-d)
A - b/c + D
-sum + partial
( (x+y) / z ) / ( a - b )
( (m - n) + (w-x-z) / (p % q )
What other kind of expression is there other than numeric expressions? ________________________
Skip ahead to Wierd integer arithmetic.
QUESTION 6:
What is the result of evaluating the following expression: 199/50 _____________________
QUESTION 7:
What is the result of evaluating the following expression: 1/2 + 1/2 __________________
QUESTION 8:
What is the value of the expression 99/100 ?
_______________
Read through the rest of the chapter until you get to Practice with Remainder Operator For positive numbers, INT % X means to fit as many X as you can into INT, and then the left over amount is the value of the expression. Try that with the following:
QUESTION 16:
If X is odd, what is X%2?
_________ because ___________________________________________
Don't worry about the remainder of the chapter for now.