Created
March 23, 2016 02:13
-
-
Save bhnascar/2b08100ce86e5826d198 to your computer and use it in GitHub Desktop.
More AP-style questions
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
public class Book | |
{ | |
private String title; | |
private String author; | |
private String genre; | |
private int numberOfPages; | |
/* Other methods not shown. */ | |
public String getTitle() { | |
/* Implementation not shown. */ | |
} | |
public String getGenre() { | |
/* Implementation not shown. */ | |
} | |
public String getAuthor() { | |
/* Implementation not shown. */ | |
} | |
public int getNumberOfPages() { | |
/* Implementation not shown. */ | |
} | |
} | |
public class Library | |
{ | |
private ArrayList<Book> books; | |
/* Other methods not shown. */ | |
/* Returns the average number of pages in books | |
* in this library. | |
*/ | |
public int averageNumberOfPages() { | |
// TODO: implement | |
return 0; | |
} | |
/* Returns the author of the book with the given | |
* title. | |
* | |
* @param title - the title. | |
*/ | |
public String getAuthorForBook(String title) { | |
// TODO: implement | |
return null; | |
} | |
/* Returns all books in this library that are | |
* written by the given author. | |
* | |
* @param author - the author. | |
*/ | |
public ArrayList<Book> getBooksByAuthor(String author) { | |
// TODO: implement | |
return null; | |
} | |
/* Returns the title of the longest book (in pages) | |
* with the given genre. | |
* | |
* @param author - the author. | |
*/ | |
public String getLongestBookWithGenre(String genre) { | |
// TODO: implement | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment