ref: 3642ff2c921852babc8be83d5614fbadd32a8818
dir: /Bookproj/User.java/
package Bookproj; import java.time.LocalDateTime; import java.util.TreeMap; public class User extends BasicUser { protected int Age; User(String username, int age) { super(Role.User, username, (int)(Math.random()*1000+101), LocalDateTime.now()); this.Age = age; } int getAge() { return this.Age; } boolean IsReserved(Book b) { return (this.getReserved().equals(b.getISBN())); } boolean IsReserved(String ISBN) { return (this.getReserved().equals(ISBN)); } TreeMap<UserAttr, String> toMap() { TreeMap<UserAttr, String> temp = new TreeMap<UserAttr, String>(); temp.put(UserAttr.Username, this.getUsername()); temp.put(UserAttr.role, getRole().toString()); temp.put(UserAttr.Reserved, getReserved()); temp.put(UserAttr.ID, Integer.toString(getID())); temp.put(UserAttr.RegTime, getRegTime().toString()); temp.put(UserAttr.Age, Integer.toString(this.Age)); temp.put(UserAttr.Active, Boolean.toString(this.Active)); return temp; } }