4
Reply

Java, pls need help with arrays...who to create add method

Alex

Alex

Sep 24 2013 7:36 PM
1.4k
public class EntityModel {

  /**
   *  The model can only store up to MAX_RECORDS
   */
  public static final int MAX_RECORDS = 10000;
  /**
   * The array storing the records
   */
  protected Entity[] allRecords;
  /**
   * The number of records being stored
   */
  protected int totalRecords;
  /**
   * The current record index. The main purpose of the class is to
   * maintain this.
   */
  protected int current;
  /**
   * A count of the number of records that have been marked for deletion
   */
  protected int delRecCount;

  // CONSTRUCTORS
  /**
   * Creates a EntityModel capable of storing <var>MAX_RECORDS</var> using
   * an array
   * <p>
   * The current position is set to -1 (undefined)
   *
   * Creates the array
   * <Initialises the totalRecords to zero
   * Initialises the delRecCount to zero
   * Sets current to be -1
   *
   *
   */
  public EntityModel() {
    //TODO
  }
 // INSERTING RECORDS
  public Entity add(Entity entity) {
    //TODO
    return null;  //remove or modify this line as needed
  }



Answers (4)