ref: c38e733d9de9f416af3f1e629bc351c4723e2425
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; } }