Question: Write a program for a user to track the number of miles a person walks each day for 5 days. The program will have an

Write a program for a user to track the number of miles a person walks each day for 5 days. The program will have an object of class HealthMeter. All data members of the meter are private. HealthMeter has a constructor that takes one parameter: name of the person. It also initializes all the variables of the class. HealthMeter has function logWalk. It is used to log the miles for a day and will keep track of the total miles walked and the number of days walked. HealthMeter will also track the miles walked on the first day and last day. HealthMeter also has at least these two functions: string getName () : returns name of person void getWalkInfo (int& totalMileage, int& daysWalked, double& avgWalkDist, int& firstWalk, int& lastWalk)

The input will be done in the main program. It will first get the persons name, then loop 4 times and prompt for the mileage walked . After each input, it will call logWalk() log the walk. The range of the input is NOT checked in main. The logWalk() function will check that the daily values are >= 0 and <= 20 by using an assert. When an assertion fails, the program should display the name of the source file, and the line number where it happened. A usual expression format is: Assertion failed: file filename, line line number Hint: #include

Test your program with valid and invalid entries for the 5 days. After the fifth entry, main will call the following functions and neatly print the results: string getName () : returns name of person void getWalkInfo (int& totalMileage, int& daysWalked, double& avgWalkDist, int& firstWalk, int& lastWalk) Test you program with the following input sequences plus any other you believe are necessary.

Note each line below is a separate run (test case) Cassie 3, 6, 7, 9 Anon 0 , 2, 5, 0 Mike 3, 12, -3, 6, 1 Pragati 8, 12, 18, 22

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 Databases Questions!