要求:按照自己的理解,给出问题的定义,然后采用Java语言,给出规范标准的描述,并设计主类完成相关功能的显示
选课是如何定义与描述的
package ch09_14;
public class Course {
private String code;//课程代码
private String teacher;//教师
private String classroom;//教室
private int number;//人数
private int credit;//学分
public String GetCode() {//课程代码
String a = code;
return a;
}
public String GetTeacher() {//教师
String b = teacher;
return b;
}
public String GetClassroom() {//教室
String c = classroom;
return c;
}
public int GetNumber() {//人数
int d = number;
return d;
}
public int GetCredit() {//学分
int e = credit;
return e;
}
public Course(String code,String teacher,String classroom,int nunber,int credit) {
this.code = code;
this.teacher = teacher;
this.classroom = classroom;
this.number = nunber;
this.credit = credit;
}
public void show() {
System.out.println("课程代码:"+GetCode());
System.out.println("教师:"+GetTeacher());
System.out.println("教室:"+GetClassroom());
System.out.println("人数:"+GetNumber());
System.out.println("学分:"+GetCredit());
}
}
package ch09_14;
public class Test_Course {
public static void main(String[] args) {
Course c1;
c1 = new Course("XR","张小花","n201",239,2);//课程代码 教师 教室 人数 学分
c1.show();
}
}