Solution Manual for Starting Out with C++: Early Objects, 10th Edition
Preview Extract
Starting Out With C++: Early Objects, Tenth Edition
Solutions to End-of-Chapter Review Questions
Chapter 1
1. programmed
2. CPU
programmer-defined symbols
3. arithmetic logic unit (ALU) and control unit
4. disk drive
Punctuation
5. operating systems and application software
6. instructions
7. programming
(or declared)
8. Machine language
processing, output
9. High-level
10. Low-level
Output
11. portability
hierarchy chart
12. key
13.
14. Operators
15.
16. syntax
17. variable
18. defined
19. input,
20. Input
21.
22.
23. Main memory, or RAM, is volatile, which means its contents are erased when power is
removed from the computer. Secondary memory, such as a disk, CD, or flash drive, does not
lose its contents when power is removed from the computer.
24. A syntax error is the misuse of a key word, operator, punctuation, or other part of the
programming language. A logical error is a mistake that tells the computer to carry out a task
incorrectly or to carry out tasks in the wrong order. It causes the program to produce the
wrong results.
25. C
26. B
27. D
28. Hierarchy Chart:
Calculate Customer’s
Available Credit
Calculate and display Available Credit
(Max Credit โ Credit Used)
Get Inputs
Read Max Credit
Read Credit Used
29. Account Balance High Level Pseudocode
Have user input starting balance
Have user input total deposits
Have user input total withdrawals
Calculate current balance
Display current balance
Account Balance Detailed Pseudocode
Input startBalance
// with prompt
Input totalDeposits
// with prompt
Input totalWithdrawals
// with prompt
currentBalance = startBalance + totalDeposits – totalWithdrawals
Display currentBalance
30. Sales Tax High Level Pseudocode
Have user input retail price
Have user input sales tax rate
Calculate tax amount
Calculate sales total
Display tax amount and sales total
Sales Tax Detailed Pseudocode
Input retailPrice
// with prompt
Input salesTaxRate
// with prompt
taxAmount = retailPrice * salesTaxRate
salesTotal = retailPrice + taxAmount
Display taxAmount, salesTotal
31. 45
32. 9
33. 7
34. 28
35. 365
36. Line 3 adds num1 + num1. It should add num1 + num2.
Line 4 displays avg, but it should display average. The name of the displayed variable must
match the name of the variable holding the answer.
37. The error is that the program performs its math operation before the user has entered values
for the variables width and length.
38. Some of the questions that should be asked are:
What standard ceiling height should be used, or is this figure to be input?
How many square feet should be subtracted out for windows and doors, or do you also
want this information input since it could vary by room?
Are the ceilings also to be painted, or just the walls?
How many square feet will 1 gallon of paint cover?
How many coats of paint will you use, or should this information be input?
Chapter 2
1. semicolon
2. iostream
3. main
4. #
5. braces {}
6. literals (also sometimes called constants)
7. 9.7865E14
8. 1, 2
9. A) valid
B) invalid
C) valid
D) valid
10. A) valid
B) valid
C) invalid D) invalid
11. All are valid.
12. A) invalid B) invalid
C) invalid D) valid
13. A) valid
B) invalid
C) valid
D) valid, but it prints the contents of
variable
Hello, not the string “Hello”.
14. A) valid
B) invalid
C) valid
15. A) 11
B) 14
C) 3
D) 3.5
16. A) 9.5
B) 14.0
C) 1.0
D) 1.75
17. double temp,
// This can also be done on a single line.
weight,
height;
18. int months = 2,
days,
years = 3;
19. A) d2 = d1 + 2;
B) d1 = d2 * 4;
C) c = ‘K’;
D) i = ‘K’;
E) i = i โ 1;
20. A) d1 = d2 โ 8.5;
B) d2 = d1 / 3.14;
C) c = ‘F’;
D) i = i + 1;
E) d2 = d2 + d1;
21.
cout << "Two mandolins like creatures in thennn";
cout << "darknnn";
cout << "Creating the agony of ecstasy.nnn";
cout << "
– George Barkernnn";
22. cout << "Ln"
<< "En"
<< "An"
<< "Fn";
23. Input weeks
days = weeks * 7
Display days
// This can also be written as a single string literal:
// cout << "LnEnAnFn";
// with prompt
24. Input eggs
cartons = eggs / 12
Display cartons
25. Input speed
Input time
distance = speed * time
Display distance
// with prompt
// perform integer divide
// with prompt
// with prompt
26. Input miles
// with prompt
Input gallons
// with prompt
milesPerGallon = miles / gallons
Display milesPerGallon
27. A) 0
100
B) 8
2
C) I am the incrediblecomputing
machine
and I will
amaze
you.
28. A) Be careful!
This might/n be a trick question.
B) 23
1
29. On line 1 the comments symbols are backwards. They should be /*
*/.
On line 2 iostream should be enclosed in angle brackets.
On line 5 there shouldn't be a semicolon after int main().
On lines 6 and 13 the opening and closing braces of function main are reversed.
On line 7 there should be a semicolon after int a, b, c.
In addition, the comment symbol is incorrect. It should be //.
On lines 8-10 each assignment statement should end with a semicolon.
On line 11 cout begins with a capital letter. In addition, the stream insertion operators
should read <> and the variable that is ouput should be c
instead of capital C.
30. Whatever problem a pair of students decides to work with they must determine such things
as which values will be input vs. which will be set internally in the program, how much
precision is required on calculations, what output will be produced by the program, and
how it should be displayed. Students must also determine how to handle situations that are
not clear cut. In the paint problem many of these considerations are listed in the teacher
answer key (Chapter 1, Question 34). In the recipe program students must determine such
things as how to handle quantities, like one egg, that cannot be halved. In the driving
program, knowing distance and speed are not enough. Agreement should be reached on
how to handle delays due to traffic lights and traffic congestion. Should this be an input
value, computed as a percent of overall driving time, or handled some other way?
Document Preview (5 of 479 Pages)
User generated content is uploaded by users for the purposes of learning and should be used following SchloarOn's honor code & terms of service.
You are viewing preview pages of the document. Purchase to get full access instantly.
-37%
Solution Manual for Starting Out with C++: Early Objects, 10th Edition
$18.99 $29.99Save:$11.00(37%)
24/7 Live Chat
Instant Download
100% Confidential
Store
Isabella Jones
0 (0 Reviews)
Best Selling
The World Of Customer Service, 3rd Edition Test Bank
$18.99 $29.99Save:$11.00(37%)
Chemistry: Principles And Reactions, 7th Edition Test Bank
$18.99 $29.99Save:$11.00(37%)
Test Bank for Hospitality Facilities Management and Design, 4th Edition
$18.99 $29.99Save:$11.00(37%)
Solution Manual for Designing the User Interface: Strategies for Effective Human-Computer Interaction, 6th Edition
$18.99 $29.99Save:$11.00(37%)
Data Structures and Other Objects Using C++ 4th Edition Solution Manual
$18.99 $29.99Save:$11.00(37%)
2023-2024 ATI Pediatrics Proctored Exam with Answers (139 Solved Questions)
$18.99 $29.99Save:$11.00(37%)