EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 4, Problem 3PE
Program Plan Intro

a.

Construct the default constructor

Program plan:

Filename: “FitnessTracker.java”

  • Import the header files in the program.
  • Define the “FitnessTracker” class.
    • Declare the required variables.
    • Define of constructor
      • Set the default values
      • Get the local date
    • Define “getActivity” method
      • Return the activity
    • Define “getMinutes” method
      • Return the minutes.
    • Define “getDate” method
      • Return the date.

Filename: “TestFitnessTracker.java”

  • Define the “TestFitnessTracker” class.
    • Define the main method.
      • Create an object for “FitnessTracker” class.
      • Display the result for exercise (a).
      • Create an object for “LocalDate” class

Program Plan Intro

b.

Construct the parameterized constructor

Program plan:

Filename: “FitnessTracker.java”

  • Import the header files in the program.
  • Define the “FitnessTracker” class.
    • Declare the required variables.
    • Define of constructor
      • Set the default values
      • Get the local date
    • Define of parameterized constructor
      • Set the values.
    • Define “getActivity” method
      • Return the activity
    • Define “getMinutes” method
      • Return the minutes.
    • Define “getDate” method
      • Return the date.

Filename: “TestFitnessTracker.java”

  • Define the “TestFitnessTracker” class.
    • Define the main method.
      • Create an object for “FitnessTracker” class.
      • Display the result for exercise (a).
      • Create an object for “LocalDate” class
      • Create an object for “FitnessTracker” class.
      • Display the result for exercise (b).

Program Plan Intro

c.

Call the three parameter constructor

Program plan:

Filename: “FitnessTracker2.java”

  • Import the header files in the program.
  • Define the “FitnessTracker2” class.
    • Declare the required variables.
    • Define of constructor
      • Set the default values using “this” method.
    • Define of parameterized constructor
      • Set the values.
    • Define “getActivity” method
      • Return the activity
    • Define “getMinutes” method
      • Return the minutes.
    • Define “getDate” method
      • Return the date.

Filename: “TestFitnessTracker2.java”

  • Define the “TestFitnessTracker2” class.
    • Define the main method.
      • Create an object for “FitnessTracker2” class.
      • Display the result for exercise (c).
      • Create an object for “LocalDate” class
      • Create an object for “FitnessTracker2” class.
      • Display the result for exercise (b).

Blurred answer
Students have asked these similar questions
Create a class named Checkup with fields that hold a patient number, two blood pressure figures (systolic and diastolic), and two cholesterol figures (LDL and HDL). Include methods to get and set each of the fields. Include a method named computeRatio() that divides LDL cholesterol by HDL cholesterol and displays the result. Include an additional method named explainRatio() that explains that HDL is known as “good cholesterol” and that a ratio of 3.5 or lower is considered optimum. Save the class as CheckupType.cpp. Create a tester program named TestCheckup whose main() method declares four Checkup objects. Call a getData() method four times. Within the method, prompt a user for values for each field for a Checkup, and return a Checkup object to the main() method where it is assigned to one of main()’s Checkup objects. Then, in main(), pass each Checkup object in turn to a showValues()method that displays the data. Blood pressure values are usually displayed with a slash between the…
a - Create a FitnessTracker class that includes data fields for a fitness activity, the number of minutes spent participating, and the date. The class includes methods to get each field. In addition, 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. Save the file as FitnessTracker.java. Create an application that demonstrates each method works correctly, and save it as TestFitnessTracker.java. b - Create an additional overloaded constructor for the FitnessTracker class you created in Exercise 3a. This constructor receives parameters for each of the data fields and assigns them appropriately. Add any needed statements to the TestFitnessTracker application to ensure that the overloaded constructor works correctly, save it, and then test it. c - Modify the FitnessTracker class so that the default constructor calls the three-parameter constructor. Save the class as FitnessTracker2.java. Create an…
create a class named checkup with fields that you read a patient number, blood pressure figures (systolic or diastolic), and two cholesterol figures (ldl and hdl). include a method named computeratio() that divides ldl cholesterol by hdl cholesterol and displays the result. include an additional method named explainratio() that explains that hdl is knowns as “good cholesterol” and that a ratio of 3.5 or lower is considered optimum pseudo code
Knowledge Booster
Background pattern image
Computer Science
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
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY