Problem 7
Fill in the blanks in each of the following statements: a) _______ are used to document a program and improve its readability. b) A decision can be made in a Java program with a(n) _______ . c) Calculations are normally performed by _____ statements. d) The arithmetic operators with the same precedence as multiplication are ________ and _______ . e) When parentheses in an arithmetic expression are nested, the ______ set of parentheses is evaluated first. f) A location in the computer’s memory that may contain different values at various times throughout the execution of a program is called a(n) ______ .
Problem 9
State whether each of the following is true or false. If false, explain why. a) Java operators are evaluated from left to right. b) The following are all valid variable names: _under_bar_, m928134, t5, j7, her_sales\(, his_\)account_total, a, b$, c, z and z2. c) A valid Java arithmetic expression with no parentheses is evaluated from left to right. d) The following are all invalid variable names: 3g, 87, 67h2, h22 and 2h.
Problem 22
What does the following code print? System.out.print("*"); System.out.println("***"); System.out.println(""); System.out.print("****"); System.out.println("**");
Problem 26
Write an application that reads two integers, determines whether the first is a multiple of the second and prints the result. [Hint: Use the remainder operator.]
Problem 31
Using only the programming techniques you learned in this chapter, write an application that calculates the squares and cubes of the numbers from 0 to 10 and prints the resulting values in table format, as shown below.