Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Removes a book by title.
- */
- public void remove(String bookTitle) {
- for(int i = 0; books.length < i; i++){
- if(books[i].getTitle().equals(bookTitle)){
- books[i] = null;
- }
- else
- {
- System.out.println("");
- }
- }
- }
- /**
- * Adds a new book.
- */
- public void add(Book book) {
- if(book != null && books.length < 100){
- int i = 11;
- books[i] = book;
- i++;
- }
- else{
- System.out.println("Book Storage is Full.");
- }
- }
- /**
- * Gets a book by title.
- */
- public Book getByTitle(String title) {
- for(int k = 0; books.length < 100; k++){
- if(books[k].getTitle().equals(title)){
- return books[k];
- }
- else{
- return null;
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement