public class Library {
public Library(String Libraries) {
}
private String Library;
public static void main(String[] args) {
Library firstLibrary = new Library("10 Main St.");
Library secondLibrary = new Library("228 Liberty St.");
//errors in this part, cannot find symbol
//Symbol: class book
//location: class library.library
firstLibrary.addBook(new Book("The Da Vinci Code")); <<<
firstLibrary.addBook(new Book("Le Petit Prince")); <<<
firstLibrary.addBook(new Book("A Tale of Two Cities")); <<<
firstLibrary.addBook(new Book("The Lord of the Rings"));<<<
System.out.println("Library hours:");
System.out.println("\nLibraries are open daily from 9am to 5pm");
//errors in this part, cannot find symbol
//symbol:method printAddress(java.lang.String)
//location:variable firstLibrary of type library.Library
System.out.println("Library addresses:");
firstLibrary.printAddress("10 Main St.");<<<
secondLibrary.printAddress("228 Liberty St.");<<<
System.out.println();
//errors in this part, cannot find symbol
//symbol:method borrowBook(java.lang.String)
//location:variable firstLibrary of type library.Library
System.out.println("Borrowing The Lord of the Rings:");
firstLibrary.borrowBook("The Lord of the Rings"); <<<
firstLibrary.borrowBook("The Lord of the Rings"); <<<
secondLibrary.borrowBook("The Lord of the Rings"); <<<
System.out.println();
//cannot find symbol
//symbol:method printAvailableBooks()
//location:variable firstLibrary of type library.Library
System.out.println("Books available in the first library:");
firstLibrary.printAvailableBooks();<<<
System.out.println();
System.out.println("Books available in the second library:");
secondLibrary.printAvailableBooks();<<<
System.out.println("II Return The Lords of the Rings to the first library");
System.out.println("Returning The Lord of the Rings:");
//cannot find symbol
/symbol:variable firstlibrary
//location:class library.Library
firstlibrary.returnBook("The Lord of the Rings");<<<
System.out.println("II Print the titles of available from the first library");
System.out.println("Books available in the first library:");
firstlibrary.printAvailableBooks();<<<
}}
NOTE: Codes with "<<<" have an errors listed above
THE OUTPUT:
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.
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 book in catalog
Returning The Lord of the Rings:
You 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