Class Calendar


public class Calendar extends Object
  • 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

      public double getTotalMiles(LocalDateTime start, LocalDateTime end, User u)
      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 - the LocalDateTime start time for the run
      end - the LocalDateTime end time for the run
      u - 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

      public double getAverageMiles(LocalDateTime start, LocalDateTime end, User u)
      Calculates average miles ran by user from start to end date.
      Parameters:
      start - start time as a LocalDateTime object
      end - end time as a LocalDateTime object
      u - user to get run data from
      Returns:
      the average number of miles ran by User u from start to end
    • getTotalCalories

      public double getTotalCalories(LocalDateTime start, LocalDateTime end, User u)
      total the number of calories burned by user from start to end.
      Parameters:
      start - start time as a LocalDateTime object
      end - end time as a LocalDateTime object
      u - user to get run data from
      Returns:
      the number of calories burned by user from start to end dates
    • getAverageCalories

      public double getAverageCalories(LocalDateTime start, LocalDateTime end, User u)
      average number of calories burned from start to end date.
      Parameters:
      start - start time as a LocalDateTime object
      end - end time as a LocalDateTime object
      u - user to get run data from
      Returns:
      the average number of calories burned from start to end date