1 回答
TA贡献1796条经验 获得超4个赞
public class Human
{
// instance variables
private String name;
private int age;
private String phone;
private String gender;
private boolean sleep;
//////////////////////////////////////////////////////////////
private int ppppp;
private String numberOfClassesMissed;
public String getNumberOfClassesMissed(){
return numberOfClassesMissed;
}
public void setNumberOfClassesMissed(String numberOfClassesMissed){
this.numberOfClassesMissed=numberOfClassesMissed;
}
public int getPpppp(){
return ppppp;
}
public void setPpppp(int ppppp){
this.ppppp=ppppp;
}
////////////////////////////////////////////////////////////
/**
* Constructors for objects of class Human
*/
public Human()
{
}
public Human(String genderIn)
{
gender = genderIn;
}
public Human(String genderIn, String nameIn)
{
public
gender = genderIn;
name = nameIn;
}
/**
* Methods for objects of class Human
*/
public void setAge(int ageIn){
age = ageIn;
}
public int getAge(){
return age;
}
public void birthday(){
age++;
}
public String getName() {
return name;
}
/**
* goToSleep()
*/
public void goToSleep()
{
sleep = true;
}
/**
* wakeUp()
*/
public void wakeUp()
{
sleep = false;
}
/**
* getSleepStatus()
* @return true if asleep else false
*/
public boolean getSleepStatus(){
return sleep;
}
}
添加回答
举报