注册 登录
编程论坛 JAVA论坛

请问关于这个怎么写测试代码?

林康 发布于 2018-04-17 20:44, 1593 次点击
package student;
import java.util.*;
public class Teacher {
    long teacherID;
    String teacherName;
    int intime;
    String technicalTitle;
    String courses;
        Teacher (long tid,String tn,int it)
        {
        teacherID=tid;
        teacherName=tn;
        intime=it;
        technicalTitle="无";
        }

    Teacher(){
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
        long getTeacherID()
        {
        return teacherID;
        }
        String getteacherName()
        {
        return teacherName;
        }
        String getTechnicalTitle()
        {
        return technicalTitle;
        }
        void setTechnicalTitle(String newtitle)
        {
        Calendar myCalendar=Calendar.getInstance();
        myCalendar.setTime(new Date());
        if((myCalendar.get(Calendar.YEAR)-intime)>5)
            technicalTitle=newtitle;
        else
            System.out.println("未到晋升时间,尚不能晋升职称。");
        }
        String SetCourses(String newc)
        {
            courses=newc;
            return courses;
        }
        public String toString()
{
return "该老师是:"+teacherID+"|"+teacherName+"|"+intime+"|"+technicalTitle+
"|"+courses;

}
}
1 回复
#2
疯狂的小a2018-04-17 21:23
你这个是想做啥。。。。
1