Class Calendar
java.lang.Object
Calendar
-
Constructor Summary
ConstructorsConstructorDescriptionCalendar()
this placeholder acts as a makeshift calendar object that can be passed into the User constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getAverageCalories(LocalDateTime start, LocalDateTime end, User u)
average number of calories burned from start to end date.double
getAverageMiles(LocalDateTime start, LocalDateTime end, User u)
Calculates average miles ran by user from start to end date.double
getTotalCalories(LocalDateTime start, LocalDateTime end, User u)
total the number of calories burned by user from start to end.double
getTotalMiles(LocalDateTime start, LocalDateTime end, User u)
Calculate the total miles a user has run in a time interval.
-
Constructor Details
-
Calendar
public Calendar()this placeholder acts as a makeshift calendar object that can be passed into the User constructor. the methods here do not interact with calendar, and as long as a user has a calendar object (by definition this must be true for every user created), then these methods can be run on those quantities
-
-
Method Details
-
getTotalMiles
Calculate the total miles a user has run in a time interval. method takes in a start and end time in the format of a localdatetime. method also takes in a user for which this check is being performed on. for every run in the user's myRuns arraylist (in user class), the method checks if the runtime of the run in the arraylist is greater than the start time passed into the method and if the runtime of the run in the arraylist is less than the end time passed into the method based on these two checks, it guarantees that all the runs surveyed are within the time interval that the user requested for after that, the simple if statement check inside just runs a bunch of get methods to check start/end time the .getMyRunDistance comes from the run class- Parameters:
start
- theLocalDateTime
start time for the runend
- theLocalDateTime
end time for the runu
- the user who is logging this run- Returns:
- totalMiles returns the total miles traveled for this user between the start and end times passed in
-
getAverageMiles
Calculates average miles ran by user from start to end date.- Parameters:
start
- start time as aLocalDateTime
objectend
- end time as aLocalDateTime
objectu
- user to get run data from- Returns:
- the average number of miles ran by
User
u from start to end
-
getTotalCalories
total the number of calories burned by user from start to end.- Parameters:
start
- start time as aLocalDateTime
objectend
- end time as aLocalDateTime
objectu
- user to get run data from- Returns:
- the number of calories burned by user from start to end dates
-
getAverageCalories
average number of calories burned from start to end date.- Parameters:
start
- start time as aLocalDateTime
objectend
- end time as aLocalDateTime
objectu
- user to get run data from- Returns:
- the average number of calories burned from start to end date
-