X1028: Loop Idioms - Repeating an Action

For this question, you will be using the Book and Shelf classes from the reading assignment.

Sometimes, a library will get multiple copies of the same book so more people can read it at the same time.

Implement the following method so that it will create 10 Book objects with the given title, author, and isbn, and add all of them to the given shelf.

Recall that the constructor for Book is:

public Book(String title, String author, int isbn) {
   ...
}

And the Shelf method to add a book is:

public void addBook(Book book) {
   ...
}

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.