?? department.java
字號:
package Entities;
import dslib.list.LinkedListUos;
import dslib.dictionary.arrayed.ArrayedPKeyedDictUos;
/** A representation of a department at the university. */
public class Department
{
public LinkedListUos instructors;
public ArrayedPKeyedDictUos courses;
protected int subjectCode;
protected String name;
protected int tuitionCategory;
public String name()
{
return name;
}
public int subjectCode()
{
return subjectCode;
}
public int tuitionCategory()
{
return tuitionCategory;
}
/** Make a new department */
public Department(String deptName, int newCode, int category)
{
name = deptName;
subjectCode = newCode;
tuitionCategory = category;
courses = new ArrayedPKeyedDictUos(10);
instructors = new LinkedListUos();
}
/** Add a new course to this department */
public void addCourse(Course newCourse)
{
courses.insert(new Integer(newCourse.number()), newCourse);
}
/** Add an instructor to this department */
public void addInstructor(Instructor i)
{
instructors.insert(i);
}
/** Add a new course section for a course in this department */
public void addCourseSection(int courseNum, CourseSection newSect)
{
((Course)courses.obtain(new Integer(courseNum))).addSection(newSect);
}
public String toString()
{
String result = "";
if (!instructors.isEmpty())
result += "\nCurrent intructors : " + instructors.toString();
else
result += "\nNo instructors yet";
if (!courses.isEmpty())
result += "\nCurrent courses : " + courses.toString();
else
result += "\nNo courses yet";
result += "\nSubject code : " + subjectCode;
result += "\nName : " + name;
result += "Tuition Category : " + tuitionCategory;
return result;
}
} /* end of Department */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -