Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

x.Hm=\"1\"> files associated with this:/** * ArrayScoreManager.java public class

ID: 3616122 • Letter: X

Question

x.Hm="1"> files associated with this:/** * ArrayScoreManager.java public class ArrayScoreManager2 extends ScoreManager {     // I. Private classes:     // II. Member vars:     private Entry entryArray[];     // III. Private and protected method(s):     // IV. Constructor(s):     ArrayScoreManager2 (int newMaxSize)     {    // 0. Run superclass constructor:    super(newMaxSize);    // I. Parameter validity check:    // II. Initialize member vars:    entryArray = new Entry[getMaxSize()];    // III. Finished:     }     // V. Accessors:     // VI. Mutator(s):     // VII. Main external work methods:     // PURPOSE: To create and return a String representation of 'this'     //          suitable for printing to the user. No parameters.     //     public String toString ()     {    // I. Parameter validity check:    // II. Create representational string:    String toReturn = "[";    for (int i = 0; i < getSize(); i++)    {         if (entryArray[i] == null)        break;         if (i > 0)        toReturn += ", ";         toReturn += entryArray[i].toString();    }    // III. Finished:    return(toReturn + "]");     }     // PURPOSE: To return an entry with score 'score', or to return 'null'     //          if no such Entry exists.     //     public Entry getEntryWithScore (int score)     {    // I. Check if there's even data in the array:    if (getSize() == 0)         return(null);    // II. Do the search    int   hiValIndex   = 0;    int   loValIndex   = getSize()-1;    int   midIndex        = (loValIndex + hiValIndex) / 2;    while (hiValIndex < loValIndex)    {         System.out.println(hiValIndex + " " + midIndex + " " + loValIndex);         if (score == entryArray[midIndex].getScore())        return(entryArray[midIndex]);         if (score < entryArray[midIndex].getScore())        hiValIndex = midIndex+1;         else        loValIndex = midIndex-1;         midIndex = (loValIndex + hiValIndex) / 2;    }    if (entryArray[hiValIndex].getScore() == score)         return(entryArray[midIndex]);    return(null);     }     // PURPOSE: To insert 'entry' at position 'index' (if it fits) by     //       moving items higher than 'index' one position higher to make     //       space for 'entry'. No return value.     //     private void insertAt (Entry entry, int index)     {    System.out.println("Putting " + entry.toString() + " at " + index);    if (index == getMaxSize())         return;    int i;    for (i = getSize(); i > index; i--)         if ( i < getMaxSize() )        entryArray[i] = entryArray[i-1];    entryArray[index] = entry;    if (getSize() < getMaxSize())         incSize();    System.out.println("Finished");     }     // PURPOSE: To insert Entry 'entry' into 'this' structure in order if     //          either there is space for it, or if it is larger than some     //          other Entry instance. If 'this' is already at its maximum     //          capacity and 'entry' is inserted then an Entry with the smallest     //          score is removed. No return value.     //     public void insert (Entry entry)     {    // I. Handle special cases:    // I.A. Handle when array is meant to be empty:    if (getMaxSize() == 0)         return;    // I.B. Handle when array is empty:    if (getSize() == 0)    {         insertAt(entry,0);         return;    }    // I.C. Handle when 'entry' is smaller than everything already

Explanation / Answer

What needs to be done here is to do a binary search on your Entryarray and use the score used in the parameter in order to see if itis in the Entry array. I can't see what the Entry class contains,so I'm assuming Entry has an int value. Anyways, create left (0)and right index (arraysize() - 1) variables to increment where tofind the score you're looking for, and start in the middle of thearray, middle_index = (left + right)/2. So,while (left