-
-
Save codecademydev/7d526c381cbbcf0d7a1f0d78557b09d6 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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