题目:
(1)按照book.java代码中的提示完成该类。该类主要提供借书、还书、查询书的借阅状态、获取书名等功能。当运行该代码的时候,输出为:
Title (should be The Da Vinci Code): The Da Vinci Code
Rented? (should be false): false
Rented? (should be true): true
Rented? (should be false): false
(2)完成Library.java,该类中的main()方法已经给出。但类成员和类方法需要完善。完成该类的时候请注意以下要求:
A.该类中有类成员方法,也有实例成员方法;
B. 不能改变main()方法的内容。
C.main( )方法的输出为:
Library hours:
Libraries are open daily from 9am to 5pm.
Library addresses:
10 Main St.
228 Liberty St.
Borrowing The Lord of the Rings:
You successfully borrowed The Lord of the Rings
Sorry, this book is already borrowed.

文章描述了如何在Java中实现Book类,用于表示书籍及其借阅状态,以及Library类,包含图书馆的相关功能如借书、还书、查询图书状态和打印地址等。
最低0.47元/天 解锁文章
545





