Write a Template Method Over Abstract Steps
mediumQuestion 550Write the abstract class Workout. It fixes the order of a training session in one finished method and leaves the content of each step to its subclasses. This is often called a template method.
Requirements:
1. warmUp() is a public abstract method with no parameters that returns a String.
2. exercise(int set) is a public abstract method that returns a String.
3. run(int sets) is a public finished method that returns one String: the text of warmUp() first, then the text of exercise(1), exercise(2) and so on up to exercise(sets).
4. Put a line break (\n) between the parts. Do not add one at the end, and add nothing else.
5. run(0) returns only the warm-up text.
The tests bring their own subclasses. For example PushUps returns Arm circles from warmUp() and a line such as Set 2: 10 push ups from exercise(2).
Do NOT write a main method.
Expected output
Arm circles Set 1: 5 push ups Set 2: 10 push ups Set 3: 15 push ups
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...