Added velocity related methods into Boat class.

- added setVelocity() and getVelocity()

#story[6]
This commit is contained in:
Haoming Yin
2017-03-07 19:34:37 +13:00
parent 6ce9674e64
commit 5c362245a4
+17
View File
@@ -9,6 +9,7 @@ public class Boat
{ {
// The name of the team, this is also the name of the boat // The name of the team, this is also the name of the boat
private String teamName = null; private String teamName = null;
private float velocity = 0;
public Boat(String teamName) { public Boat(String teamName) {
this.teamName = teamName; this.teamName = teamName;
@@ -29,4 +30,20 @@ public class Boat
public void setTeamName(String teamName){ public void setTeamName(String teamName){
this.teamName = teamName; this.teamName = teamName;
} }
/**
* Sets velocity of the boat
* @param velocity The velocity of boat
*/
public void setVelocity(float velocity) {
this.velocity = velocity;
}
/**
* Gets velocity of the boat
* @return a float number of the boat velocity
*/
public float getVelocity() {
return this.velocity;
}
} }