I am working on the purpose of CS-101 and I am allowed to use only one array. I have an array that looks like this:
[Song, Song, Album, Fiction, Movie, Nonfiction, Song]
Here is the hierarchy for the background (requirements of my purpose):
"At the top level, you will have the Library class. The library will have three subclasses: Music, Book and Movie. Music will have two subclasses: Song and Album., Fiction, Non-Recognition, Song, and Album will not have any subclasses."
I'm currently trying to write a method that will sort books by their ISBN number. So Fiction and Nonfiction are subclasses of my Book class, which is a subclass of the library.
I keep everything in the Library myLibrary[] = new Library[100];
I'm not sure how to search for ISBNs only from books and sort them, since I am only allowed one array; otherwise, I would like to create an array of books and then sort them separately.
What are some tips / algorithms I can use to accomplish this?
Update
I can send more code if necessary. But this question is currently more focused on this approach.
source share