Question: Modify the program to keep track of all objects input into the system into a counter (an int variable). Increment the counter by one each

Modify the program to keep track of all objects input into the system into a counter (an int variable). Increment the counter by one each time an object's name and mass is input. (b) Modify the program to display the 'Total Input Count' at the end, after the user inputs -5 and before ending the program (c) Modify the program again to have another counter, countValid (or something similar), which is only incremented when the object's weight is accepted (between 1000 and 10). Display this counter at the end as well (d) Finally, modify the program to keep a running total of the weight in Newtons of all valid objects. Objects that are too heavy or too light should not be included in this count. (e) At the end, display the total valid weight as well as the average valid weight (total/countValid). See Code Listing 4-13 for calculating the average after the while loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!