3 Replies Latest reply on Oct 31, 2007 1:46 PM by 807600

    Array question

      Here is the problem I got:

      I created a book class with various methods. On top of that I created another class called Library. Library class constructor is supposed to have a field saying how many books are in the "library". You enter a number, and it should generate an array with the specified number of slots (that will contain books). Those slots should be filled with books objects that are called Book 1 Book 2... Book n.

      I managed to create this Array but I can't create a method that adds the books (and calls them Book 1, 2, 3 and so on).

      How should I go about doing this?

      public class Library

      private TextBook[] bookShelf;
      public int nextBook;
      private int borrowers;

      public Library(int max)
      bookShelf = new TextBook[max];
      nextBook = 0;

      is what i got so far.
      help me and u shall be rewarded