This commit is contained in:
2022-03-19 17:47:52 +08:00
parent 6bf672bd5b
commit 1c8f95c4b3
35 changed files with 1597 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
/*
* Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
* Date: 2022-03-19
* Description: This is the class of Bird.
*/
public class Bird extends Animal {
/**
* Altitude of the bird.
*/
private double altitude;
/**
* Constructor of Bird.
*
* @param name name of the bird
* @param weight weight of the bird
* @param altitude altitude of the bird
*/
public Bird(String name, double weight, double altitude) {
super(name, weight);
this.altitude = altitude;
}
/**
* Get the altitude of the bird.
*
* @return altitude of the bird
*/
public double getAltitude() {
return altitude;
}
/**
* Test
*/
public static void testBird() {
Bird bird = new Bird("Bird", 1.0, 10.0);
System.out.println(bird.getName() == "Bird");
System.out.println(bird.getWeight() == 1.0);
System.out.println(bird.getAltitude() == 10.0);
}
}