100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Solution Manual for An Introduction to Programming with C++ 8th Edition by Diane Zak $18.48   Add to cart

Exam (elaborations)

Solution Manual for An Introduction to Programming with C++ 8th Edition by Diane Zak

 18 views  1 purchase
  • Course
  • SolutionManual
  • Institution
  • SolutionManual

Solution Manual for An Introduction to Programming with C++ 8th Edition by Diane Zak

Preview 4 out of 87  pages

  • August 8, 2024
  • 87
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • SolutionManual
  • SolutionManual
avatar-seller
solutions
Solution Manual For
An Introduction to Programming with C++ 8th Edition by Diane Zak
Chapter 1-15

Chapter 1
An Introduction to Programming with C++: Eighth Edition
Chapter 1 Answers


Review Questions
1. d sorting
2. c sequence
3. d sequence
4. a an algorithm
5. b repetition
6. c selection
7. b selection
8. a repetition
9. c both repetition and selection
10. b selection

Exercises
1. The answer to this TRY THIS Exercise is located at the end of Chapter 1 in the book.
2. The answer to this TRY THIS Exercise is located at the end of Chapter 1 in the book.
3. repeat for (each customer buying a TV)
enter the original price of the TV
if (the customer is one of the first 10)
calculate the discount by multiplying the original price by 25%
else
calculate the discount by multiplying the original price by 15%
end if
calculate the total due by subtracting the discount from the original price
print a bill showing the original price, discount, and total due
end repeat
4.
1. repeat (4 times)
enter a number
calculate the sum by adding the number to the sum
end repeat
2. calculate the average by dividing the sum by 4
3. display the average
5.
repeat for (each component name on the list)
read the component name from the list
search for the component
if (the component was received)
cross the component name off the list
else
circle the component name on the list
end if

, end repeat

6. Version 1:
repeat for (each customer)
enter the number of tickets
if (the number of tickets is greater than 4)
display the message “You can purchase up to 4 tickets only.”
else
calculate the amount owed by multiplying the number of tickets by $35
display the amount owed
end if
end repeat

Version 2:
repeat for (each customer)
enter the number of tickets
if (the number of tickets is less than or equal to 4)
calculate the amount owed by multiplying the number of tickets by $35
display the amount owed
else
display the message “You can purchase up to 4 tickets only.”
end if
end repeat

7.
1. repeat (6 times)
if (the flower is red)
pick the flower with your right hand
else
pick the flower with your left hand
end if
walk forward one complete step
end repeat
2. walk forward one complete step

8.
repeat (5 times)
enter the employee’s name, hours worked, and pay rate
if (hours worked is less than or equal to 40)
calculate gross pay = hours worked times pay rate
else
calculate regular pay = pay rate times 40
calculate overtime hours = hours worked minus 40
calculate overtime pay = overtime hours * pay rate * 1.5
calculate gross pay = regular pay + overtime pay
end if
print the employee’s name and gross pay
end repeat

9. repeat (for each employee)

, enter the employee’s payment schedule and annual salary
if (the employee’s payment schedule is weekly)
calculate gross pay = annual salary / 52
else
calculate gross pay = annual salary / 26
end if
display the gross pay
end repeat

10.
1. multiply 7 by 5, giving a product of 35
2. divide 20 by 2, giving a quotient of 10
3. multiply 4 by 2, giving a product of 8
4. subtract the result of step 2 (10) from the result of step 1 (35), giving
a difference of 25
5. add the result of step 4 (25) to the result of step 3 (8), giving a sum of 33

11.
1. enter Store A’s price and Store B’s price
2. calculate the cost at Store A by dividing Store A’s price by 2 and then
adding the result to Store A’s price
3. calculate the cost at Store B by multiplying Store B’s price by 2
4. if (the cost at Store A is less than or equal to the cost at Store B)
display the message “Buy at store A”
else
display the message “Buy at store B”
end if

12.
1. repeat (3 times)
walk forward one complete step
end repeat
2. turn left 90 degrees
3. repeat (2 times)
walk forward one complete step
end repeat
4. turn right 90 degrees
5. repeat (3 times)
walk forward one complete step
end repeat
6. turn left 90 degrees
7. walk forward one complete step
8. turn right 90 degrees
9. repeat (4 times)
walk forward one complete step
end repeat
10. repeat (2 times)
turn right 90 degrees
end repeat
11. sit down

, 13.
1. walk into the maze
2. turn left 90 degrees
3. repeat until (you are directly in front of a wall)
walk forward one complete step
end repeat
4. turn right 90 degrees
5. repeat until (you are directly in front of a wall)
walk forward one complete step
end repeat
6. turn right 90 degrees
7. repeat until (you are directly in front of a wall)
walk forward one complete step
end repeat
8. turn left 90 degrees
9. repeat until (you are directly in front of a wall)
walk forward one complete step
end repeat
10. turn left 90 degrees
11. repeat until (you are directly in front of a wall)
walk forward one complete step
end repeat
12. turn right 90 degrees
13. repeat until (you are directly in front of a wall)
walk forward one complete step
end repeat
14. turn left 90 degrees
15. repeat until (you are directly in front of a wall)
walk forward one complete step
end repeat
16. turn right 90 degrees
17. repeat until (you are out of the maze)
walk forward one complete step
end repeat




An Introduction to Programming with C++: Eighth Edition
Chapter 2 Answers


Review Questions
11. b Analyze the problem
12. b output

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller solutions. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $18.48. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79789 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$18.48  1x  sold
  • (0)
  Add to cart