Question: You're developing a component for a fitness tracking system that logs various exercises ( e . g . , running, swimming, cycling ) with details

You're developing a component for a fitness tracking system that logs various exercises (e.g., running, swimming, cycling) with details like duration and distance. Your task is to create an ExerciseEntry class that tracks exercise type, duration, and rate of perceived exertion (RPE) as instance variables. It should also have a static variable to track the total duration across all entries, along with member functions to display entry details and retrieve the total duration.
Perform the following:
Declare a class named ExerciseEntry.
Inside the class, declare instance member variables for:
exerciseType (type string)durationMinutes (type int)intensityLevel (type int) to represent the RPE
Declare a public static member variable named totalDurationMinutes to track the total exercise duration across all instances of the ExerciseEntry class.
Write a constructor for the ExerciseEntry class that accepts arguments for each instance member variable and initializes them. The constructor should also add the current objects duration to the totalDurationMinutes static member variable.
Implement an instance member function named displayDetails to print the exercise type, duration, and intensity level. The output should appear in the following format:
"Exercise Type: , Duration (minutes): , Intensity Level (RPE): "
where is the value of the exerciseType member, is the value of the durationMinutes member, and is the value of the intensityLevel member. Make sure your output matches this format exactly, and ends with a newline.
Implement a static member function named getTotalDurationMinutes to return the value of the totalDurationMinutes member. Question
Goal: Learn how to write static data member and member functions.
Assignment: You're developing a component for a fitness tracking system that logs various exercises (e.g., running, swimming, cycling) with details like duration and distance. Your task is to create an ExerciseEntry class that tracks exercise type, duration, and rate of perceived exertion (RPE) as instance variables. It should also have a static variable to track the total duration across all entries, along with member functions to display entry details and retrieve the total duration.
Perform the following:
1. Declare a class named ExerciseEntry.
2. Inside the class, declare instance member variables for:
- exerciseType (type string)
- durationMinutes (type int)
- intensityLevel (type int) to represent the RPE
3. Declare a public static member variable named totalDurationMinutes to track the total exercise duration across all instances of the ExerciseEntry class.
4. Write a constructor for the ExerciseEntry class that accepts arguments for each instance member variable and initializes them. The constructor should also add the current object's duration to the totalDurationMinutes static member variable.
5. Implement an instance member function named displayDetails to print the exercise type, duration, and intensity level. The output should appear in the following format:
"Exercise Type: , Duration (minutes): , Intensity Level (RPE): "
where is the value of the exerciseType member, is the value of the durationMinutes member, and is the value of the intensityLevel member. Make sure your output matches this format exactly, and ends with a newline.
6. Implement a static member function named getTotalDurationMinutes to return the value of the totalDurationMinutes member.
You're developing a component for a fitness

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