This question involves the implementation of a fitness tracking system that is represented by the StepTracker class. A S
Posted: Sun May 15, 2022 12:29 pm
This question involves the implementation of a fitness tracking system that is represented by the StepTracker class. A Step Tracker object is created with a parameter that defines the minimum number of steps that must be taken for a day to be considered active The StepTracker class provides a constructor and the following methods • add DailySteps, which accumulates information about steps, in readings taken once per day activeDeys, which returns the number of active days • averageSteps, which returns the average number of steps per day, calculated by dividing the total number of steps taken by the number of days tracked The following table contains a sample code execution sequence and the corresponding results. Statements and Expressions Value Returned (blank if no value) Comment StepTracker tr-new Step Tracker(10000); ): Days with at least 10,000 steps are considered active tractive Days: o No data have been recorded yet tr.averageSteps) 0.0 When no step data have been recorded, the averageSteps method returns 0.0. . tr.addDaily Steps(9000); This is too few steps for the day to be considered active. . - traddDailySteps(5000); This is too few steps for the day to be considered tractive Days: No day had at least 10,000 steps. tr.averageSteps: 7000.0 The average number of steps per day is (14000 / 2) tr.acdDaily Steps(13000): This represents an active day tractive Days: 1 of the three days for which step data were entered, one day had at least 10,000 steps. tr.averageSteps: 9000.0 The average number of steps per day is (27000/3). . M tr.addDailySteps(2000): This represents an active day tr.addDailySteps(1111): This is too few steps for the day to be considered active. tractiveDays: 2 of the five days for which step data were entered two days had at least 10,000 steps. traverageSteps 10222.2 The average number of steps per day is (51111/5).