/**
*This is my first java class. I am very excited. It about doctor. I hope you like it.
*/
public class Doctor
{
private String name;
private String hospital;
private String spec;
private int review;
/**
*This is the constructor for Doctor class.
*param n - doctor name;
*param h - doctor hospital name;
*param s - doctor's specialty;
*/
public Doctor(String n, String h, String s, int r)
{
name = n;
hospital = h;
spec = s;
review = r;
}
/**
*This method gives the doctor name
*/
public String getDocName()
{
return name;
}
/**
*This can change the doctor name
*/
public void setDocName(String newName)
{
name = newName;
}
/**
*This method gives the hospital name that the doctor is working in
*/
public String getHospital()
{
return hospital;
}
public void setDocHospital(String newHospitalName)
{
hospital = newHospitalName;
}
/**
*This method gives the doctor specialty.He/She is the expert on this field.
*/
public String getDocSpecialty()
{
return spec;
}
public void setDocSpec(String newSpecialty)
{
spec = newSpecialty;
}
/**
*This method gives the doctor review
*/
public int getDocReview()
{
return review;
}
public void setNewReview(int newNumber)
{
review = newNumber;
}
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史