Part A Create a FitnessTracker class that includes three data fields for a fitness activity: a String for the name of the activity as activity, an int for the number of minutes spent participating as minutes, and a LocalDate for the date as date. 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 so it receives parameters for each of the fields and assigns them appropriately. Includes methods to get each data field. Part B Create an application that instantiates two FitnessTracker 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. An example of the program is shown below: Enter activity >> swimming Enter minutes spent swimming >> 90 Enter month >> 2 Enter day >> 24 Enter year >> 2021 Activity log: swimming 90 minutes on 2021-02-24 running 0 minutes on 2021-01-01         Task #01: Create the FitnessTracker class. Task #02: Add the three data fields to the FitnessTracker class. Task #03: Create the default FitnessTracker constructor. Task #04: Overload the FitnessTracker constructor to accept parameters for each data field. Task #05: Include get methods for each data field. Task #06: Create the TestFitnessTracker application

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 13RQ
icon
Related questions
Question

 

Part A

Create a FitnessTracker class that includes three data fields for a fitness activity: a String for the name of the activity as activity, an int for the number of minutes spent participating as minutes, and a LocalDate for the date as date.

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 so it receives parameters for each of the fields and assigns them appropriately.

Includes methods to get each data field.

Part B

Create an application that instantiates two FitnessTracker 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.

An example of the program is shown below:

Enter activity >> swimming Enter minutes spent swimming >> 90 Enter month >> 2 Enter day >> 24 Enter year >> 2021 Activity log: swimming 90 minutes on 2021-02-24 running 0 minutes on 2021-01-01

 

 
 

 

Task #01: Create the FitnessTracker class.

Task #02: Add the three data fields to the FitnessTracker class.

Task #03: Create the default FitnessTracker constructor.
Task #04: Overload the FitnessTracker constructor to accept parameters for each data field.

Task #05: Include get methods for each data field.

Task #06: Create the TestFitnessTracker application

 

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,