2019 AP® COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS 2. This question involves the implementation of a fitness tracking system that is represented by the StepTracker class. A StepTracker 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. addDailySteps, which accumulates information about steps, in readings taken once per day activeDays, 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 Comment (blank if no value) StepTracker tr = StepTracker (10000); Days with at least 10,000 steps are considered active. Assume that the parameter is positive. new tr.activeDays (); No data have been recorded yet. When no step data have been recorded, the averageSteps method returns 0.0. tr.averageSteps (); 0.0 tr.addDailySteps (9000); This is too few steps for the day to be considered active. tr.addDailySteps (5000); This is too few steps for the day to be considered active. tr.activeDays () ; No day had at least 10,000 steps. tr.averageSteps (); 7000.0 The average number of steps per day is (14000/ 2). tr.addDailySteps (13000); This represents an active day. Of the three days for which step data were entered, one day had at least 10,000 steps. tr.activeDays () ; 1 tr.averageSteps (); 9000.0 The average number of steps per day is (27000/3). tr.addDailySteps (23000); This represents an active day. tr.addDailySteps (1111); This is too few steps for the day to be considered active. Of the five days for which step data were entered, two days had at least 10,000 steps. tr.activeDays () ; 2 tr.averageSteps (); 10222.2 The average number of steps per day is (51111/5).

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
2019 AP® COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS
2. This question involves the implementation of a fitness tracking system that is represented by the
StepTracker class. A StepTracker 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.
addDailySteps, which accumulates information about steps, in readings taken once per day
activeDays, 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
Comment
(blank if no
value)
StepTracker tr
StepTracker(10000);
Days with at least 10,000 steps are considered
active. Assume that the parameter is positive.
new
tr.activeDays () ;
No data have been recorded yet.
When no step data have been recorded, the
averageSteps method returns 0.0.
tr.averageSteps();
0.0
tr.addDailySteps (9000);
This is too few steps for the day to be considered
active.
tr.addDailySteps (5000);
This is too few steps for the day to be considered
active.
tr.activeDays () ;
No day had at least 10,000 steps.
tr.averageSteps();
7000.0
The average number of steps per day is (14000/ 2).
tr.addDailySteps (13000);
This represents an active day.
Of the three days for which step data were entered,
one day had at least 10,000 steps.
tr.activeDays () ;
1
tr.averageSteps();
9000.0
The average number of steps per day is (27000 / 3).
tr.addDailySteps (23000);
This represents an active day.
This is too few steps for the day to be considered
active.
tr.addDailySteps (1111) ;
Of the five days for which step data were entered,
two days had at least 10,000 steps.
tr.activeDays () ;
2
tr.averageSteps();
10222.2
The average number of steps per day is (51111 / 5).
Transcribed Image Text:2019 AP® COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS 2. This question involves the implementation of a fitness tracking system that is represented by the StepTracker class. A StepTracker 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. addDailySteps, which accumulates information about steps, in readings taken once per day activeDays, 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 Comment (blank if no value) StepTracker tr StepTracker(10000); Days with at least 10,000 steps are considered active. Assume that the parameter is positive. new tr.activeDays () ; No data have been recorded yet. When no step data have been recorded, the averageSteps method returns 0.0. tr.averageSteps(); 0.0 tr.addDailySteps (9000); This is too few steps for the day to be considered active. tr.addDailySteps (5000); This is too few steps for the day to be considered active. tr.activeDays () ; No day had at least 10,000 steps. tr.averageSteps(); 7000.0 The average number of steps per day is (14000/ 2). tr.addDailySteps (13000); This represents an active day. Of the three days for which step data were entered, one day had at least 10,000 steps. tr.activeDays () ; 1 tr.averageSteps(); 9000.0 The average number of steps per day is (27000 / 3). tr.addDailySteps (23000); This represents an active day. This is too few steps for the day to be considered active. tr.addDailySteps (1111) ; Of the five days for which step data were entered, two days had at least 10,000 steps. tr.activeDays () ; 2 tr.averageSteps(); 10222.2 The average number of steps per day is (51111 / 5).
2019 AP® COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS
Write the complete StepTracker class, including the constructor and any required instance variables and
methods. Your implementation must meet all specifications and conform to the example.
Transcribed Image Text:2019 AP® COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS Write the complete StepTracker class, including the constructor and any required instance variables and methods. Your implementation must meet all specifications and conform to the example.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY