A bug collector collects bugs every day for five days. Write a program that keeps a running total of the number of bugs collected during the five days. The loop should ask for the number of bugs collected for each day, and when the loop is finished, the program should display the total number of bugs collected.
Solution
VerifiedNote that this program is very similar to the one that we wrote for Algorithm Workbench exercise 4 (see my answer to that question for some extra info on syntax). That only important difference is that in this program, I'll loop over a list of the days of the week instead of just the numbers 0 through 4. Note that this is unnecessary -- you could absolutely use a function and just not mention the day of the week when displaying the prompts. That's completely fine, as well.
Create an account to view solutions
Create an account to view solutions
Recommended textbook solutions

Computer Organization and Design MIPS Edition: The Hardware/Software Interface
5th Edition•ISBN: 9780124077263 (5 more)David A. Patterson, John L. Hennessy

Fundamentals of Database Systems
7th Edition•ISBN: 9780133970777 (1 more)Ramez Elmasri, Shamkant B. Navathe