At Westonci.ca, we make it easy to get the answers you need from a community of informed and experienced contributors. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.

Silas develops this algorithm to compute the calories burned for an activity for a given number of minutes and body weight: If the activity is running, compute caloriesPerMin by dividing weight by 10.5 If the activity is walking, compute caloriesPerMin by dividing weight by 15.5 Compute numCalories by multiplying caloriesPerMin by numMinutes He implements the algorithm in an app, and users soon ask for the ability to compute the total calories for multiple sessions of walking or running. What structure must be added to the original algorithm so that it can compute the total across multiple sessions

Sagot :

Answer:

Explanation:

This change can be accomplished in one of two ways. The first being creating a global variable that adds to it and saves the total calories burned at the end of every session. This global variable can then be called at any time to show the total number of calories burned in all previous sessions combined. The other option would be to create a list of Session objects. Each object would hold all the information regarding each session including calories burned. Then create a function that loops through this list, adding the total calories burned in each session and outputting the total.

We appreciate your time on our site. Don't hesitate to return whenever you have more questions or need further clarification. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Westonci.ca is here to provide the answers you seek. Return often for more expert solutions.