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

can you post your code in [ Code ] tags without the extra lines and symbols in?

well, basically, you're calling a lot of methods that don't exist.
also, you're trying to create instances of Book with a String param, but as far as I know, your Book class doesn't have such a constructor.

make sure you create all the methods you're using, or you'll automatically get error messages during compilation.

Don't know where to start......

by implementing the missing methods.

So far this is what I did can you help me with some errors?

public class Library {

    private static class ArrayList<T> {
        public ArrayList() {
        }
    }

    public static class Book {
        public Book() {
        }
    }
public Library(String address){
}  
public Library(String LibAddress, Book bk) {  
            address = LibAddress;  
            book = bk;  
        }
    String address;  
    String title;  
    int noOfBooks;  
    int date;
    Book book = new Book("Book Title");  
    ArrayList<Book> myArr = new ArrayList<Book>();  
    String[] myAr = new String[noOfBooks];  
    ArrayList<String> BookList = new ArrayList();  
    //ArrayList<Score> list = new ArrayList<Score>(); 
 public static void printOpeningHours() {  
            System.out.println("Library hours");  
            System.out.println("Libraries are open daily from 9am to 5pm.");   
        }      
public String getAddress(){  
            return address;     
        }
public void printAddress() {  
            System.out.println(address);  
        }  
public String getTitle () {  
            //if(title != null)  
            return title;  
        }
public void addBook(Book bookObject) {      
          if (bookObject != null && noOfBooks<4) {      
              //book[noOfBooks] = bookObject;  
              //myAr[noOfBooks] = book[noOfBooks];  
              noOfBooks++; //increase after adding one book to the Library      
           }// end if      
} // end add
public static void main(String[] args) {

Library firstLibrary = new Library("10 Main St.");
Library secondLibrary = new Library("228 Liberty St.");

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"));

printOpeningHours();
System.out.println("Library addresses:"); 
firstLibrary.printAddress(); 
secondLibrary.printAddress(); 
System.out.println();

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();

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:"); 
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();
}}

can you post your code in [ Code ] tags without the extra lines and symbols in?

Do we have to repeat?

public class Library {

private static class ArrayList<T> {
public ArrayList() {
}
}
public static class Book {
public Book() {
}
}
public Library(String address){
} 
public Library(String LibAddress, Book bk) { 
address = LibAddress; 
book = bk; 
}
String address; 
String title; 
int noOfBooks; 
int date;
Book book = new Book("Book Title"); 
ArrayList<Book> myArr = new ArrayList<Book>(); 
String[] myAr = new String[noOfBooks]; 
ArrayList<String> BookList = new ArrayList(); 
//ArrayList<Score> list = new ArrayList<Score>(); 
public static void printOpeningHours() { 
System.out.println("Library hours"); 
System.out.println("Libraries are open daily from 9am to 5pm."); 
} 
public String getAddress(){ 
return address; 
}
public void printAddress() { 
System.out.println(address); 
} 
public String getTitle () { 
//if(title != null) 
return title; 
}
public void addBook(Book bookObject) { 
if (bookObject != null && noOfBooks<4) { 
//book[noOfBooks] = bookObject; 
//myAr[noOfBooks] = book[noOfBooks]; 
noOfBooks++; //increase after adding one book to the Library 
}// end if 
} // end add
public static void main(String[] args) {

Library firstLibrary = new Library("10 Main St.");
Library secondLibrary = new Library("228 Liberty St.");

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"));

printOpeningHours();
System.out.println("Library addresses:"); 
firstLibrary.printAddress(); 
secondLibrary.printAddress(); 
System.out.println();

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();

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:"); 
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();
}}

and ... what are the errors that remain?

public class Library {
 
private static class ArrayList<T> {
public ArrayList() {
}
}
public static class Book {
public Book() {
}
}
public Library(String address){
} 
public Library(String LibAddress, Book bk) { 
address = LibAddress; 
book = bk; 
}
String address; 
String title; 
int noOfBooks; 
int date;
Book book = new Book("Book Title"); 
ArrayList<Book> myArr = new ArrayList<Book>(); 
String[] myAr = new String[noOfBooks]; 
ArrayList<String> BookList = new ArrayList(); 
//ArrayList<Score> list = new ArrayList<Score>(); 
public static void printOpeningHours() { 
System.out.println("Library hours"); 
System.out.println("Libraries are open daily from 9am to 5pm."); 
} 
public String getAddress(){ 
return address; 
}
public void printAddress() { 
System.out.println(address); 
} 
public String getTitle () { 
//if(title != null) 
return title; 
}
public void addBook(Book bookObject) { 
if (bookObject != null && noOfBooks<4) { 
//book[noOfBooks] = bookObject; 
//myAr[noOfBooks] = book[noOfBooks]; 
noOfBooks++; //increase after adding one book to the Library 
}// end if 
} // end add
public static void main(String[] args) {
 
Library firstLibrary = new Library("10 Main St.");
Library secondLibrary = new Library("228 Liberty St.");
 
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"));
 
printOpeningHours();
System.out.println("Library addresses:"); 
firstLibrary.printAddress(); 
secondLibrary.printAddress(); 
System.out.println();
 
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();
 
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:"); 
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();
}}

The highlight with red are errors, what to do? Im looking for solutions.

are these included in your code?

import java.io.*;
import java.util.*;

you made an obvious mistake here use // for comments

System.out.println();II Return The Lords of the Rings to the first library

include methods in your class

public static class Book {
public Book() {
}
}

addBook(and most of the others) method should be in the Book class

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"));

Stultuske already corrected your errors before:

well, basically, you're calling a lot of methods that don't exist.
also, you're trying to create instances of Book with a String param, but as far as I know, your Book class doesn't have such a constructor.

make sure you create all the methods you're using, or you'll automatically get error messages during compilation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.