2019 FRQ
2019 FRQ
public class StepTracker {
private int activeDaysCount = 0;
private int totalDays = 0;
private int totalSteps = 0;
private int minSteps;
public StepTracker(int steps) {
minSteps = steps;
}
public void addDailySteps(int steps) {
if (steps >= minSteps) {
activeDaysCount++;
}
totalDays++;
totalSteps += steps;
}
public int activeDays() {
return activeDaysCount;
}
public double averageSteps() {
if (totalDays == 0) {
return 0.0;
}
return (double) totalSteps / totalDays;
}
}