我正在从事图书馆项目;有一个图书馆课:
public Library(int id, String libName, String libAddress, double libBudget, boolean libEnabled)
和图书馆员班:
Public Librarian(int id, String firstname,String surname,
String email, String nss, String password, int role, int library, boolean enabledLibrarian)
每个图书馆员都被分配到一个图书馆:
Librarian.getLibrary(int x);
项目范围需要管理多个库,所以我有一个控制器,它会在开始时生成我的库列表
public static List<Library> libraries()
[购买书籍,批准贷款等方法都在Library()类下。我不确定该怎么做才能获取对象Library()的实例,其中Library()的参数等于Librarian()-]中相应参数的实例
private static void LibrarianLanding(Librarian librarian, Library library) { System.out.println("Welcome, " + librarian.getFirstname() + " " + librarian.getSurname()); System.out.println("You are in the Admin area of Library No." + librarian.getLibrary()); Library library = libraries.get() //WHERE library.getID() == Librarian.getLibrary(); library.PurchaseSomeBooks(librarian);
也许它很简单,我想念。
我正在从事图书馆项目;有一个Library类:public Library(int id,String libName,String libAddress,double libBudget,boolean libEnabled)和一个Librarian类:Public Librarian(...
如果您将库列表更改为以库ID为键的库地图,如下所示: