staffset.java

来自「国外的数据结构与算法分析用书」· Java 代码 · 共 47 行

JAVA
47
字号
package Sets;

import Entities.*;
import dslib.dictionary.arrayed.ArrayedPKeyedDictUos;

/**	This class provides access to a dictionary of
	staff members that is keyed by name.  Staff members include
	registrars, instructors and administrators. */
public class StaffSet
{
	/**	Provides access to the dictionary of departments. */
	public static ArrayedPKeyedDictUos rep;
	
	public static void displayNames()
	{
		System.out.println("Professors");
		System.out.println("Albert Einstien, password: e=mc^2, department: 345");
		System.out.println("Mark Keil, password: 3sat, department: 865");
		System.out.println("Eric Neufeld, password: AI, department: 865\n");
		System.out.println("Registrar");
		System.out.println("Fred Smith, password: regis\n");
		System.out.println("Administrator");
		System.out.println("Joe Blow, password: admin\n");
	}
	
	static //execute only once (never explicitly called though)
	{	
		rep = new ArrayedPKeyedDictUos(10);

		Instructor prof = new Instructor("Albert Einstien", "e = mc^2",345);
		rep.insert(prof.name(), prof);
		
		prof = new Instructor("Mark Keil", "3sat",865);
		rep.insert(prof.name(), prof);    

		prof = new Instructor("Eric Neufeld", "AI",865);
		rep.insert(prof.name(), prof);

		Registrar regis = new Registrar("Fred Smith", "regis");
		rep.insert(regis.name(), regis);

		Administrator admin = new Administrator("Joe Blow", "admin");
		rep.insert(admin.name(), admin);
	}
	
} /* end of StaffSet */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?