Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions Journey.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,48 @@ public double getKilometers() {
}

}
/*By the group of Jingxian And Connie*/

package org.jx.test;
public class Journey {
private static final int SERVICE_KILOMETER_LIMIT = 100;
private double kilometers;

/**
* Class constructor
*/
public Journey() {
this.kilometers = 0;
}

/**
* Appends the distance parameter to {@link #kilometers}
* @param kilometers the distance traveled
*/
public void addKilometers(double kilometers) {
System.err.println(this.kilometers);
System.err.println(kilometers);
this.kilometers += kilometers;
}

/**
* Calculates the total services by dividing kilometers by
* {@link #SERVICE_KILOMETER_LIMIT} and floors the value (Truncates the two
* decimal places).
*
* @return the number of services needed per
* {@link #SERVICE_KILOMETER_LIMIT}
*/
public int getTotalServices() {
return (int) Math.floor(kilometers / SERVICE_KILOMETER_LIMIT);
}

/**
*
* @return {@link #kilometers}
*/
public double getKilometers() {
return kilometers;
}

}