Question: Each of the two exercises can either be a regular type of exercise ( represented by anExercise class ) , or a strength training activity

Each of the two exercises can either be a regular type of exercise (represented by anExercise class), or a strength training activity (represented by a StrengthTraining class).You are to write both the Exercise and StrengthTraining classes.The Exercise class tracks the following information: The exercise name (for example, "Bike ride" or "Run") The duration in minutes The intensity level (a String with a value of either "low", "medium" or "high")A StrengthTraining is a special Type of Exercise, so the StrengthTraining class inheritsthe properties of the Exercise class, including name, duration, and intensity. (For fullmarks, your solution must use inheritance.) In addition, a StrengthTraining object tracks: The number of sets The number of reps per set (reps stands for repetitions; the number of timesthe weight is lifted during each set) The maximum weight lifted in poundsFor example, a strength training session might involve lifting a 40-pound weight tentimes per set, all of that repeated eight times. In that case, the number of sets is 8, thenumber of reps per set is 10, and the max weight lifted is 40.(The total number of repsin that workout would be 80, but that number could be calculated so it is not stored.)Include in each of those three classes (Workout, Exercise, and StrengthTraining) astandard constructor, as well as standard accessor and mutator methods for each of theinstance variables.The constructor for the Workout class has five parameters, including one for the warm-up exercise and one for the main exercise.Include a toString() method in each of the Exercise and StrengthTraining classes. Theversion for the Exercise class should produce a result that resembles the following:Exercise: Bike RideDuration: 60 minutesIntensity: mediumThe duration variable stores a numeric value, so the word "minutes" is added by thetoString() method.The version for the StrengthTraining class calls the Exercise toString() method to helpproduce a result that resembles the following:Exercise: Circuit TrainingDuration: 45 minutesIntensity: highNumber of Sets: 18Reps per Set: 10Max Weight Lifted: 135 poundsAlso include a method in each of the Exercise and StrengthTraining classes thatestimates and returns the number of calories burned by completing that exercise (avalue of type double). Those two methods have the same name but are in differentclasses.

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!