Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program on Linux system that keeps track of the amount of exercise that a person does. When the program starts, ask them

Write a C++ program on Linux system that keeps track of the amount of exercise that a person does. When the program starts, ask them to enter the type of exercise they have done, the amount of time they exercised, and the calories that they have burned. Echo back the information that they typed and then ask them if they would like to record the time and calories. Use a char variable to record their response. If they type y for yes, add the values to running totals. If they type n for no, then discard the information. The total amount of exercise time and calories burned will be displayed at program termination. See below for example output.

After the user has entered the first exercise activity, ask them if they would like to enter another activity, and instruct them to type y for yes (add another activity), or n for no (quit the program). Use a char data type to allow the user to quit or add another activity. Because the user will decide what to do, you will need a menu driven loop for this assignment, most likely a sentinel-controlled while or do-while loop.

Example Output

Welcome to the exercise tracking program.

What exercise activity did you do? Elliptical

How many minutes? 30

How many calories did you burn? 300

OK, you did the Elliptical for 30 minutes, and burned 300 calories.

Record the activity time and calories (y/n)? y

Your activity info has been recorded.

Would you like to enter another activity (y/n)? y

What exercise activity did you do? Treadmill

How many minutes? 15

How many calories did you burn? 85

OK, you did the Treadmill for 15 minutes, and burned 85 calories.

Record the activity time and calories (y/n)? n

Your activity has not been recorded.

Would you like to enter another activity (y/n)? y

What exercise activity did you do? Treadmill

How many minutes? 20

How many calories did you burn? 95

OK, you did the Treadmill for 20 minutes, and burned 95 calories.

Record the activity time and calories? y/n: y

Your activity info has been recorded.

Would you like to enter another activity (y/n)? n

Thank you for using the exercise tracking program. Here are your totals:

Total exercise minutes: 50

Total exercise calories: 395

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago