Add: assignment 2 close #2
This commit is contained in:
24
assignment2/Question1/HalfMarathon.java
Normal file
24
assignment2/Question1/HalfMarathon.java
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
|
||||
* Date: 2022/03/04
|
||||
* Description: This is the Running class which is the subclass of the Sport class
|
||||
*/
|
||||
|
||||
public class HalfMarathon extends Marathon {
|
||||
/**
|
||||
* Constructor. Half marathon always has player number 99 and length of 21.0975
|
||||
*/
|
||||
public HalfMarathon() {
|
||||
super(99, 21.0975);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test.
|
||||
*/
|
||||
public static void testHalfMarathon() {
|
||||
HalfMarathon hm = new HalfMarathon();
|
||||
System.out.println(hm.getLength() == 21.0975);
|
||||
System.out.println(hm.getPlayerNumber() == 99);
|
||||
System.out.println(hm.isFun() == false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user