Question: Please create a driver class for the sequence class. There should be an ArrayList. and Driver class should have the main method and exercises the

Please create a driver class for the sequence class. There should be an ArrayList. and Driver class should have the main method and exercises the sequence class. this is what I have for the Class Sequence. I have class Sequence and the sequence test is done.

public class Sequence { //Variable private int counter ; private E[] data ; private int size ; //default Constructor //assigning public Sequence(Class c) { size = 100 ; data = (E[]) new Object[size] ; counter = 0 ;

} /** * @return size */ public int size() { return size ; } /** * @param element */ public void append(E element) { if (counter >= size) { throw new IllegalArgumentException("Full") ; } data[counter++] = element ; } /** * @param k * @return data[k] */ public E get(int k) { if (k > counter) { throw new IllegalArgumentException("Not enough data") ; } return data[k] ; } /** * @param k * @param element */ public void set(int k, E element) { if(k > counter) { throw new IllegalArgumentException("Not enough data") ; } data[k] = element ; } } Please create a driver class for the sequence class. There should be

a. 1. Creation of project 2. Package should include: Driver class....... b. Sequence class 2. Compilation and execution a. Driver class and Sequence class compile without errors. b. Correct answers on test data....... 3. Defined Sequence class The class is generic b. Has two private instance variables: data[] and size Has default constructor.. d. Has constructor with one parameter (the capacity).. a. C. e. Has size () method f. Has append(E element) method.. g. Has get (k) method, returning an E type object, where k is an index......... h. Has set (k, E newElement) method, where k is an index

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!