Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 23, 2017 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/7d526c381cbbcf0d7a1f0d78557b09d6 to your computer and use it in GitHub Desktop.
Save codecademydev/7d526c381cbbcf0d7a1f0d78557b09d6 to your computer and use it in GitHub Desktop.
Codecademy export
import java.util.HashMap;
public class Library {
public Library();
public void getFinishedBooks
(HashMap<String,Boolean> library)
{ if (library.size < 1 ) {
System.out.println("ERROR");
} else{
for (String book: library.keySet())
{if (library.get(book) == true)
{System.out.println("\nThis book has been completed: " + book);
}
}
}
}
public static void main (String[] args){
HashMap<String, Boolean> myBooks = new HashMap<String, Boolean>();
myBooks.put("Road Down the Funnel", true);
myBooks.put("Rat: A Biology", false);
myBooks.put("TimeIn", false);
myBooks.put("3D Food Printing", false);
Library myLibrary = new Library ();
myLibrary.getFinishedBooks(myBooks);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment