CJCoding With Joseph
15free / daySign inCreate account

Write 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.

Hints4 available
Topics
Abstract ClassesClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.