






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Name CIS 203 Midterm I: Chapters 15. October 3, 2007 Directions: This is a closed book, closed notes examination. Place your answers in the space provided. The point value of each question is indicated. There are a total of xx points. Your total out of 63 will be weighted to 100 points. You have 55 minutes for this examination.
public class DoubleArraySeq implements Cloneable { // data members private double[ ] data; private int manyItems; private int currentIndex; // constructor public DoubleArraySeq( ) { data = new double[10]; manyItems = 0; currentIndex = 01; } // addBefore public void addBefore(int element) { // Implemented by student. } // advance public void advance( ) { currentIndex++; } // ensureCapacity public void ensureCapacity(int minimumCapacity) { if (getCapacity() >= minimumCapacity) return; double[] newData = new double[minimumCapacity]; for (int i = 0; i < manyItems; i++) newData[i] = data[i]; data = newData; } // getCapacity public int getCapacity( ) { return data.length(); } // isCurrent public boolean isCurrent( ) { return currentIndex >=0 && currentIndex < manyItems; } // size public int size( ) { return manyItems; } // start public void start( ) { // Implemented by student. } }