EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
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
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…
Please help me solve this with java..I posted it many times and got rejected I don't ?    Game class instructions:• Game class has three attributes: points (which represent the number of points awarded when winning the game), status (false if the game has not been played and true if the game has been played), and description (which is a text description of the game). Note that description attribute is a read-only variable. • In the constructor, initialize points to zero, status to false, and description to the given parameter.• isPlayed method returns true if the game has been played, and false otherwise.• getPoints is a getter method for points attribute.• play method is an abstract method.• Override toString method to return the game description.• Override equals method so that two games are the same if their descriptions are the same. :instructions class ) HangMan• HangMan is a game in which a player tries to guess a word based on a given hint. For example, if the given hint is…
Create a class for Subject containing the Name of the subject and score of the subject. There should be following methods: set: it will take two arguments name and score, and set the values of the attributes. If score is less than 0 or greater than 100.0 then a message should be displayed “Incorrect score” and score should be set to Zero. set: it will take one double value as argument and set the value of score only. If score is less than 0 or greater than 100.0 then a message should be displayed “Incorrect score” and score should be set to Zero. display: it will display the name and score of the subject. Like “Name : Math, Score: 99.9” getScore: it will return the value of score. greaterThan: it will take subject’s object as argument, compare the calling object’s score with argument object’s score and return true if the calling object has greater score. Create a class “Main” having main method to perform following tasks. Create two objects of Subject class having value “Math, 99.9”…
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
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
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