瀏覽代碼

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 年之前
父節點
當前提交
e41e28bff6
共有 1 個檔案被更改,包括 19 行新增1 行删除
  1. +19
    -1
      Main.java

+ 19
- 1
Main.java 查看文件

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


Loading…
取消
儲存