college.java
来自「国外的数据结构与算法分析用书」· Java 代码 · 共 41 行
JAVA
41 行
package Entities;
import dslib.dictionary.arrayed.ArrayedPKeyedDictUos;
import dslib.list.LinkedListUos;
public class College
{
/** Data Attributes */
protected String name;
public ArrayedPKeyedDictUos students;
protected LinkedListUos departments;
/** Make a college with name 'collegeName' */
public College(String collegeName)
{
name = collegeName;
students = new ArrayedPKeyedDictUos(100);
departments = new LinkedListUos();
}
/** Add student 'newStudent' to the current college. */
public void addStudent(Student newStudent)
{
/** insert student and make a mapping from their
student number to them */
students.insert(new Integer(newStudent.studentNum()), newStudent);
}
/** Add a new department to this college */
public void addDepartment(Department newDepart)
{
departments.insert(newDepart);
}
} /* end of College */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?