中国人、アメリカ人、北京人

2474 ワード

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();

	}



}