Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*CODE IN JAVA* Implement the following classes as represented in the class diagrams. Methods and constructors are explained below. You will define 4 types of

image text in transcribedimage text in transcribed

*CODE IN JAVA*

Implement the following classes as represented in the class diagrams. Methods and constructors are explained below. You will define 4 types of activities: Run, Bike, Swim and the fourth activity is of your choice. Note that the getter/setter methods for all properties are not included in the UML diagram. Run -title: String - notes: String - caloriesBurned: int - minutes: int - distance: double + Run(title: String, notes: String, caloriesBurned: int, minutes: int, distance: double) Bike -title: String - notes: String - caloriesBurned: int - minutes: int - distance: double - location: String + Bike(title: String, notes: String, caloriesBurned int, minutes: int, distance: double, location: String) Swim -title: String - notes: String - caloriesBurned: int - distance: double - laps: int - stroke: String + Swim(title: String, notes: String, caloriesBurned: int, distance: double, laps: int, stroke: String) Override each of the toString() methods to format and output each type of activity. You should print out each property of the object. Suppose that you have a running activity in the gym. You may create an instance of Run class and print out the running activity details in the terminal window. Here is one possible sample output from the toString() method of the Run class. Please note that the output format of your to String() method may not be the same as the sample, but you should print out each property of the object. R Problems @ Javadoc Declaration Console x RunTest.testToString [JUnit] /Library/Java/JavaVirtu Activity - Run RUN: Gym Running Notes: A short running on the treadmill Calories: 300 Distance: 3.0 miles Minutes: 30 min

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions