Przeglądaj źródła

Main.java

- borrowBook(User, Book) is added as a unified function that will
update and change all required data when a user attempts to borrow a
book
master
BinHong Lee 8 lat temu
rodzic
commit
e41e28bff6
1 zmienionych plików z 19 dodań i 1 usunięć
  1. +19
    -1
      Main.java

+ 19
- 1
Main.java Wyświetl plik

@@ -1,6 +1,6 @@
/*
* Written by : Bin Hong Lee
* Last edited : 5/31/2016
* Last edited : 6/12/2016
*/

import java.util.Date;
@@ -17,6 +17,24 @@ class Main

}

public static boolean borrowBook(User user, Book book)
{
User newUser = user;

if(book.getStatus() == "AVAILABLE" && newUser.status())
{
book.rent(calDueDate(10));
newUser.borrowNewBook(book.getId());

books.update(book);
users.update(user, newUser);

return true;
}

return false;
}

public static boolean returnBook(User user, Book book)
{
User newUser = user;


Ładowanie…
Anuluj
Zapisz