Problem Set 12: Library Rental(Winter Break Assignment)

Web-CAT: Submit Java programs to this automated grading platform.

Task Outline

Background Theory

The Problem Scope

public static String displayOpeningHours()
public String displayAddress()
public String addBook(Book novel)
public String borrowBook(String novelName)
public String returnBook(String textName)

Hints

Example Case

Adding books to the first library:
You have successfully added The Da Vinci Code
You have successfully added Le Petit Prince
You have successfully added A Tale of Two Cities
You have successfully added The Lord of the Rings

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 have successfully borrowed The Lord of the Rings
Sorry, this book is already borrowed.
Sorry, this book is not in our catalog.

Books available in the first library:
The Da Vinci Code
Le Petit Prince
A Tale of Two Cities

Books available in the second library:
No books in our catalog.

Returning The Lord of the Rings to the second library:
Sorry, this book is not in our catalog.

Returning The Lord of the Rings to the first library:
You have successfully returned The Lord of the Rings

Books available in the first library:
The Da Vinci Code
Le Petit Prince
A Tale of Two Cities
The Lord of the Rings

Code Distribution

Description File Size File Name
Java Source Code for Library Rental 12KB pset12.zip

Contents of pset12.zip:

PSet12LibraryRental/
├── Book.class
├── Book.ctxt
├── Book.java
├── Library.class
├── Library.ctxt
├── Library.java
├── LibraryJUnitTest.class
├── LibraryJUnitTest.ctxt
├── LibraryJUnitTest.java
├── LibraryTest.class
├── LibraryTest.ctxt
├── LibraryTest.java
├── package.bluej
└── README.TXT

Specification

public static String displayOpeningHours()
public String displayAddress()
public String addBook(Book novel)
public String borrowBook(String novelName)
public String returnBook(String textName)

Testing

Submission