Java 中国人、美国人、北京人

package package1;

public class People {
	protected double weight;
	protected double height;
	public void speckHello(){
		System.out.println("yayaya");
	}
	public void averageHeight(){
		height=173;
		System.out.println("average height:"+height);
	}
	public void averggeWeight(){
		weight=70;
		System.out.println("average weight:"+weight);
	}
}
package package1;

public class ChinaPeople extends People {
	public void speckHello(){
		System.out.println("您好");
	}
	public void averageHeight(){
		height=168.78;
		System.out.println("中国人的平均身高:"+height+"厘米");
	}
	public void averggeWeight(){
		weight=65;
		System.out.println("中国人的平均体重:"+weight+"千克");
	}
	public void chinaGongfu(){
		System.out.println("坐如钟,站如松,睡如弓!");
	}
}
package package1;

public class AmericanPeople extends People{
	public void speckHello(){
		System.out.println("How do you do");
	}
	public void averageHeight(){
		height=176;
		System.out.println("American's average height:"+height+"cm");
	}
	public void averggeWeight(){
		weight=75;
		System.out.println("American's average weight:"+weight+"kg");
	}
	public void americanBoxing(){
		System.out.println("直拳,勾拳,组合拳!");
	}
}
package package1;

public class BeijingPeople extends ChinaPeople{
	public void averageHeight(){
		height=172.5;
		System.out.println("北京人的平均身高:"+height+"厘米");
	}
	public void averggeWeight(){
		weight=70;
		System.out.println("北京人的平均体重:"+weight+"千克");
	}
	public void beijingOpera(){
		System.out.println("花脸,青衣,花旦和老生!");
	}
}
package package1;

public class Test {
	public static void main(String[] args) {
		ChinaPeople chinapeople=new ChinaPeople();
		AmericanPeople americanpeople=new AmericanPeople();
		BeijingPeople beijingpeople=new BeijingPeople();
		chinapeople.speckHello();
		americanpeople.speckHello();
		beijingpeople.speckHello();
		chinapeople.averageHeight();
		americanpeople.averageHeight();
		beijingpeople.averageHeight();
		chinapeople.averggeWeight();
		americanpeople.averggeWeight();
		beijingpeople.averggeWeight();
		chinapeople.chinaGongfu();
		americanpeople.americanBoxing();
		beijingpeople.beijingOpera();
		beijingpeople.chinaGongfu();
	}

}

你可能感兴趣的:(Java 中国人、美国人、北京人)