Personal Library Project Java


#1



https://www.codecademy.com/en/courses/learn-java/projects/personal-library?link_content_target=interstitial_project


Library.java:2: error: '{' expected
public class Library(){
^
1 error


import java.util.HashMap;
public class Library(){
  public Library (){
    
  }
    public void getFinishedBooks( HashMap<String, Boolean> library) {
      if (library.size() < 1) {
        System.out.println("Error! Hashmap is Empty.");
      } else {
        for ( String book: library.keySet()){
         
          if (library.containskey(true)) {
            System.out.println("This book has been completed" + book);
          }
        }
        }
      }
   public static void main(String[] args) {
     HashMap myBooks = new HashMap();
     myBooks.put("Road Down The Funnel", true);
     myBooks.put("Rat: A Biology", false);
     myBooks.put("TimeIn", true);
     myBooks.put("3D Food Printing", false);
     
     Library myLibrary = new Library();
     myLibrary.getFinishedBooks(myBooks);
    }
}


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.