47 lines
874 B
Java
47 lines
874 B
Java
/*
|
|
* Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
|
|
* Date: 2022/03/04
|
|
* Description: This is the Sport class.
|
|
*/
|
|
|
|
public class Sport {
|
|
private int playerNumber;
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param playerNumber
|
|
*/
|
|
public Sport(int playerNumber) {
|
|
this.playerNumber = playerNumber;
|
|
}
|
|
|
|
/**
|
|
* Getter for playerNumber.
|
|
*
|
|
* @return playerNumber
|
|
*/
|
|
public int getPlayerNumber() {
|
|
return playerNumber;
|
|
}
|
|
|
|
/**
|
|
* Whether the sport is fun or not. Some sport are fun and some sports are not
|
|
* fun. By default the sport is not fun.
|
|
*
|
|
* @return true if the sport is fun, false if the sport is not fun.
|
|
*/
|
|
public boolean isFun() {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Test.
|
|
*/
|
|
public static void testSport() {
|
|
Sport sport = new Sport(10);
|
|
System.out.println(sport.getPlayerNumber() == 10);
|
|
System.out.println(sport.isFun() == false);
|
|
}
|
|
}
|