public class User extends Object
Constructor and Description |
---|
User(String name,
int id,
int limit)
Creates a new User with name, id and limit (usually used to add new User)
|
User(String name,
int id,
int limit,
ArrayList<Integer> books)
Creates a new User with name, id, limit and books (usually used to initialize from database)
|
Modifier and Type | Method and Description |
---|---|
int[] |
bookStatus()
Get Book ids of the books
|
boolean |
borrowNewBook(int id)
User borrows a Book
|
int |
getId()
Gets id of this User
|
int |
getLimit()
Gets limit of Book this User can borrow
|
String |
getName()
Gets name of this User
|
boolean |
returnBook(int id)
User returns a Book
|
void |
setLimit(int limit)
Change limit of this User
|
void |
setName(String name)
Change name of this User
|
boolean |
status()
Check status of the User
|
public User(String name, int id, int limit)
name
- Name of this Userid
- id of this Userlimit
- Limit of Book this User can borrowpublic User(String name, int id, int limit, ArrayList<Integer> books)
name
- Name of this Userid
- id of this Userlimit
- Limit of Book this User can borrowbooks
- ArrayList of Book ids borrowed by the Userpublic String getName()
public int getId()
public int getLimit()
public void setName(String name)
name
- New name of the Userpublic void setLimit(int limit)
limit
- New limit of the Userpublic boolean status()
public int[] bookStatus()
public boolean borrowNewBook(int id)
id
- id of the Book to tbe borrowedpublic boolean returnBook(int id)
id
- id of the Book to be returnedCopyright © 2017. All rights reserved.