Files
oop/finalproject/Question9/User.java
2022-05-24 23:41:21 +08:00

70 lines
1.2 KiB
Java

/*
* Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
* Date: 2022-04-25
* Description: This is the User class.
*/
public abstract class User implements IUser {
/**
* The user's name.
*/
private String name;
/**
* The number of books borrowed by the user.
*/
private int book;
/**
* Constructor.
*
* @param name The user's name.
* @param book The number of books borrowed by the user.
*/
public User(String name, int book) {
this.name = name;
this.book = book;
}
/**
* Getter of the user's name.
*
* @return The user's name.
*/
public String getName() {
return name;
}
/**
* Getter of the number of books borrowed by the user.
*
* @return The number of books borrowed by the user.
*/
public int getBook() {
return book;
}
/**
* Change the number of books borrowed by the user.
*
* @param book The number of books borrowed by the user.
*/
protected void setBook(int book) {
this.book = book;
}
/**
* Increase the number of books borrowed by the user.
*
* @param book The number of books borrowed by the user.
*/
public abstract void moreBook(int number) throws NotALenderException;
/**
* Test.
*/
public static void testUser() {
// abstract class not testing
}
}