Unit 5 Homework
Unit 5 Homework
public class StepTracker {
private int totalSteps;
private int minimumSteps;
private int days;
private int activeDays;
public StepTracker(int min){
minimumSteps = min;
totalSteps = 0;
days = 0;
activeDays = 0;
}
public void addDailySteps(int steps){
totalSteps += steps;
days++;
if (steps >= minSteps){
activeDays++;
}
}
public double averageSteps(){
if (days == 0){
return 0.0;
}
else{
return (double) totalSteps / days;
}
}
public int getActiveDays(){
return days;
}
}