Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 2 - Exercises - Page 86: 10

Answer

Step 1 Set values of Cost and Total to 0 Step 2 Set value of count to 1 Step 3 While (count $\leq 12 )$ perform Steps 4 through 9 Step 4 Read in value for $M_{s}$ Step 5 Read in value for $M_{e}$ Step 6 Add $\left(M_{e}-M_{s}\right)$ to the value of Total Step 7 If $\left(\left(M_{e}-M_{s}\right) \leq 1000\right)$ then add $\left(\left(M_{e}-M_{s}\right) \cdot 6\right)$ to the value of Cost $\quad$ else Step 8 Add $\left(1000 \cdot 6+\left(\left(M_{e}-M_{s}-1000\right) \cdot 8\right) \text { to the value of } \text {Cost}\right.$ Step 9 Add 1 to the value of count Step 10 Print out "Your total annual charge is (Cost) dollars" Step 12 Stop

Work Step by Step

--
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.