Quellcode durchsuchen

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 vor 8 Jahren
Ursprung
Commit
e41e28bff6
1 geänderte Dateien mit 19 neuen und 1 gelöschten Zeilen
  1. +19
    -1
      Main.java

+ 19
- 1
Main.java Datei anzeigen

@@ -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;


Laden…
Abbrechen
Speichern