Class Run
java.lang.Object
Run
- Author:
- s306639
-
Constructor Summary
ConstructorsConstructorDescriptionRun(LocalDateTime start, LocalDateTime end, double myRunDistance, double myCalories)
CONSTRUCTOR precondition: instance variables have been declared postcondition: data has been initialized options has been initialized by invoking the appropriate method -
Method Summary
Modifier and TypeMethodDescriptionvoid
Method for adding a specific Run to a person's profile/list Preconditions: User u and Run x are both initialized and hold their respective data Postconditions: Run x is added to the hashmap of user Uvoid
Method for calculating the duration of a run in seconds Preconditions: instance variables are initialized Postconditions: The duration in seconds is printed out into the consoledouble
Getter method for myCaloriesGetter method for myEndRunTimedouble
Getter method for myRunDistanceint
Getter method for myRunDurSecGetter for myStartRunTimelong
Convert current time from hours, minutes, seconds, into seconds only Preconditions: LocalDateTime t contains the correct time Postconditions: The given time is presented in secondsvoid
setCalories(double calories)
Setter method for myCaloriesvoid
setMyRunDistance(double runDistance)
Setter method for myRunDistancevoid
setMyStartRunTime(LocalDateTime startRunTime)
Setter method for myStartRunTime
-
Constructor Details
-
Run
CONSTRUCTOR precondition: instance variables have been declared postcondition: data has been initialized options has been initialized by invoking the appropriate method- Parameters:
start
- , the local start time of a given Runend
- , the local end time of a given RunmyRunDistance
- , the distance of a given RunmyCalories
- , the amount of calories burnt in a given Run
-
-
Method Details
-
addRun
Method for adding a specific Run to a person's profile/list Preconditions: User u and Run x are both initialized and hold their respective data Postconditions: Run x is added to the hashmap of user U- Parameters:
u
- , an object that contains information about a userx
- , a specific run
-
calculateRunDurSec
public void calculateRunDurSec()Method for calculating the duration of a run in seconds Preconditions: instance variables are initialized Postconditions: The duration in seconds is printed out into the console -
getSecondDuration
Convert current time from hours, minutes, seconds, into seconds only Preconditions: LocalDateTime t contains the correct time Postconditions: The given time is presented in seconds- Parameters:
t
- , LocalDateTime, the current local time- Returns:
- long(current time in seconds)
-
getMyRunDurSec
public int getMyRunDurSec()Getter method for myRunDurSec- Returns:
- int(myRunDurSec)
-
getMyRunDistance
public double getMyRunDistance()Getter method for myRunDistance- Returns:
- double(myRunDistance)
-
setMyRunDistance
public void setMyRunDistance(double runDistance)Setter method for myRunDistance- Parameters:
runDistance
- , a double value of the distance of a run
-
getMyStartRunTime
Getter for myStartRunTime- Returns:
- myStartRuntime, a LocalDateTime of the start time of a run
-
setMyStartRunTime
Setter method for myStartRunTime- Parameters:
startRunTime
- , a LocalDateTime value of the starting time
-
getMyEndRunTime
Getter method for myEndRunTime- Returns:
- LocalDateTime(the end time of a run)
-
getCalories
public double getCalories()Getter method for myCalories- Returns:
- myCalories(the amount of calories burnt in a run)
-
setCalories
public void setCalories(double calories)Setter method for myCalories- Parameters:
caloriee
- (the amount of calories burnt in a run)
-