Question: a. Create a Fitness Tracker class that includes three data fields for a fitness activity: a String for the name of the activity, an int

a. Create a Fitness Tracker class that includes three data fields for a fitness activity: a String for the name of the activity, an int for the number of minutes spent participating, and a Local Date for the date. The class includes methods to get each field. Create a default constructor that automatically sets the activity to running, the minutes to 0, and the date to January 1 of the current year. Overload the constructor that receives parameters for each of the fields and assigns them appropriately. Save the file as FitnessTracker.java.
b. Create an application that instantiates two Fitness Tracker objects. Prompt the user for values for one object, and pass those values to the three constructor parameters. Retain the default constructor values for the other object. Display the values for each object. Save the program as TestFitnessTracker.java.

Step by Step Solution

3.26 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a b import javatime public class Fitness Tracker String activity int ... View full answer

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