Jcreator4的问题??
//filename: people_test.java
//定义people类
class people{
public people(){
height = 0;
weight = 0;
}
public double height,weight;
public void speak_hello(){
System.out.println( "Hello! ");
}
public void average_height(){
System.out.println(height);
}
public void average_weight(){
System.out.println(weight);
}
}
//定义China_people
class China_people extends people{
public void China_gongfu(){
System.out.println( "坐如钟,站如松,睡如弓 ");
}
public void speak_hello(){
System.out.println( "你好,吃饭了吗 ");
}
public void average_height(){
this.height = 173.0;
System.out.println( "中国人的平均身高: "+height+ "厘米 ");
}
public void average_weight(){
this.weight = 67.34;
System.out.println( "中国人的平均体重: "+weight+ "公斤 ");
}
}
//定义American_people
class American_people extends people{
public void American_boxing(){
System.out.println( "直拳、钩拳 ");
}
public void speak_hello(){
System.out.println( "How do you do ! ");
}
public void average_height(){
this.height = 188.0;
System.out.println( "American average height: "+height+ " cm ");
}
public void average_weight(){
this.weight = 80.23;
System.out.println( "American average weight: "+weight+ " kg ");
}
}
//定义Beijing_people
class Beijing_people extends people{
public void Beijin_opera(){
System.out.println( "京剧术语 ");
}
public void speak_hello(){
System.out.println( "您好 ");
}
public void average_height(){
this.height = 176.0;
System.out.println( "北京人的平均身高: "+height+ "厘米 ");
}
public void average_weight(){
this.weight = 67.0;
System.out.println( "北京人的平均体重: "+weight+ "公斤 ");
}
}
//主类
public class people_test {
public static void main(String[] args) {
China_people cp = new China_people();
American_people ap = new American_people();
Beijing_people bp = new Beijing_people();
cp.speak_hello();
ap.speak_hello();
bp.speak_hello();
cp.average_height();
ap.average_height();