lab5
This commit is contained in:
28
lab/lab5/Question7/Chicken.java
Normal file
28
lab/lab5/Question7/Chicken.java
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
|
||||
* Date: 2022-03-19
|
||||
* Description: This is the Chicken class.
|
||||
*/
|
||||
|
||||
public class Chicken extends Bird {
|
||||
/**
|
||||
* Constructor of Chicken class. A chicken always has a weight of 5.0 and an
|
||||
* altitude of 0.0. Chicken spend all their time on the ground.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public Chicken(String name) {
|
||||
super(name, 5.0, 0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test.
|
||||
*/
|
||||
public static void testChicken() {
|
||||
Chicken chk1 = new Chicken("chicken1");
|
||||
|
||||
System.out.println(chk1.getName() == "chicken1");
|
||||
System.out.println(chk1.getWeight() == 5.0);
|
||||
System.out.println(chk1.getAltitude() == 0.0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user