public interface carepet {	public void food();	public void play();}public class Worker implements carepet{	String name;	public Worker(String name){		this.name=name;	}	public void food(){		System.out.println("这个叫"+name+"的工人是这样喂他的宠物的");	}	public void play(){		System.out.println("这个叫"+name+"的工人是这样和它的宠物玩的");	}}public class farmer implements carepet{	int age;	String name;	public farmer(int age,String name){		this.age=age;		this.name=name;	}	public void food(){		System.out.println("这个叫"+name+"的"+age+"的农民是这样喂他的宠物的");	}	public void play(){		System.out.println("这个叫"+name+"的"+age+"的农民是这样和它的宠物玩的");	}}

public class StateLeader implements carepet{

String job;

public StateLeader(String job){

this.job=job;

}

public void food(){

System.out.println("这个"+job+"是这样喂他的宠物的");

}

public void play(){

System.out.println("这个"+job+"的农民是这样喂他的宠物的");

}

}

public class CarePetTest {

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

Worker wk1=new Worker("王海洋");

Worker wk2=new Worker("李佳阳");

farmer fm1=new farmer(32,"张山河");

farmer fm2=new farmer(40,"王国");

StateLeader sl1=new StateLeader("军委书记");

StateLeader sl2=new StateLeader("教育部长");

wk1.food();

wk2.food();

fm1.food();

fm2.food();

sl1.food();

sl2.food();

wk1.play();

wk2.play();

fm1.play();

fm2.play();

sl1.play();

sl2.play();

}

}