Professional Documents
Culture Documents
https://testbankfan.com/download/starting-out-with-java-from-control-structures-throu
gh-data-structures-2nd-edition-gaddis-solutions-manual/
Gaddis: Starting Out with Java: From Control Structures through Data Structures, 2/e © 2012 Pearson Education 1
Chapter 3
Multiple Choice and True/False
1. b
2. d
3. a
4. b
5. c
6. d
7. a
8. b
9. a
10. a
11. a
12. c
13. c
14. b
15. c
16. False
17. True
18. True
19. True
20. False
21. True
6. The statement should use the && operator instead of the || operator.
7. The statement should use the || operator instead of the && operator.
8. The : and ? are reversed in their positions. The statement should read:
z = (a < 10) ? 0 : 7;
9. The equalsIgnoreCase method should be used instead of the equals
method.
Algorithm Workbench
1. if (y == 0)
x = 100;
2. if (y == 10)
x = 0;
else
x = 1;
4. if (minimum)
hours = 10;
9. if (title1.compareTo(title2) < 0)
System.out.println(title1 + " " + title2);
else
System.out.println(title2 + " " + title1);
11. C, A, B
12. "00000.000"
13. "0.00"
14. "000,000,000.00"
Short Answer
No sé cómo te he escuchado,
Colón, sin auer reído,
Hasta el fin, lo que has hablado;
El hombre más loco has sido
Que el cielo ha visto y criado
Un muerto con frenesí
Te pudo mover ansí
Con dos borrados papeles:
Si de engañar vivir sueles,
¡Cómo te atreves á mí!
Á Castilla y á León
Nuevo mundo dió Colón,
De altos espíritus es
Aspirar á empresas altas,
Y ver con dolor las faltas
De los que muerden sus pies.