Question: i need this done in C++ please!! Write a program for a user to track the number of miles a person walks each day for
i need this done in C++ please!!
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:
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
Get step-by-step solutions from verified subject matter experts
