Expressions
Category: Expressions
Author: Alan Borning and Dan Grossman
Book Chapter: 2.1
Problem: Expressions
For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of appropriate type and capitalization. e.g., 7 for an int, 7.0 for a double, "hello" for a String, true or false for a boolean.
1) 3 * (7 + 1) - 3 - 7 + 2
2) 9 % 5 + 20 % 5 + 20 % 3
3) 2.3 * 2.0 + 1.5 * 10 / 3
4) 1 + 2 + "3 + 4" + 5 + 6 / 4
5) 5 % 2 + 10 / 5 / 2 + 4.2