Question: Here is a simplified class for representing books owned by library: class Book { String title, author; / / title, author String callNumber; / /

Here is a simplified class for representing books owned by library:
class Book {
String title, author; // title, author
String callNumber; // call number, such as "QA567.23 P23"
}
Suppose that a library owns 27,532 books and that information about all the books has already been stored in an array
Book[] books = new books[27532];
a) A science book is one whose call number begins with the letter 'Q'. Write a method that will count the number of science books owned by the library and return that number. HINT there is a string method called charAt().
b) Write another method that will print out the answer to this question: Does the library own more books by "Isaac Asimov" or more books by "William Shakespeare"? Write a code segment that will find out. Print the answer with System.out.println().

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!