中国人、美国人、北京人

package people;

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

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

package people;

public class ChinaPeople extends People{

	public void speakHello()
	{
		System.out.println("您好");
	}
	
	public void averageHeight()
	{
		height = 168.78;
		System.out.println("中国人的平均身高:"+height+"厘米");
	}
	
	public void averageWeight()
	{
		weight = 65;
		System.out.println("中国人的平均体重:"+weight+"千克");
	}
	
	public void chinaGongFu()
	{
		System.out.println("坐如钟、站如松、行如风");
	}
}

package people;

public class People {		//基类
	double height;
	double weight;
	
	public void speakHello()
	{}
	
	public void averageHeight()
	{}
	
	public void averageWeight()
	{}
}

package people;

public class Example {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ChinaPeople chinaPeople=new ChinaPeople();
		AmericanPeople americanPeople=new AmericanPeople();
		BeijingPeople beijingPeople=new BeijingPeople();
		chinaPeople.speakHello();
		americanPeople.speakHello();
		beijingPeople.speakHello();
		chinaPeople.averageHeight();
		americanPeople.averageHeight();
		beijingPeople.averageHeight();
		chinaPeople.averageWeight();
		americanPeople.averageWeight();
		beijingPeople.averageWeight();
		chinaPeople.chinaGongFu();
		americanPeople.americanBoxing();
		beijingPeople.beijingOpera();
		beijingPeople.chinaGongFu();
	}

}


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