Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please create a driver class for the sequence class. There should be an ArrayList this is what I have for Class Sequence. public class Sequence

image text in transcribedimage text in transcribedPlease create a driver class for the sequence class. There should be an ArrayList

this is what I have for Class Sequence.

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 ; } }

a. 1. Creation of project2. Package should include: a. Driver class... b. Sequence class. 2. Compilation and execution Driver class and Sequence class compile without errors.. b. Correct answers on test data ........ 3. Defined Sequence class a. The class is generic b. Has two private instance variables: data[] and size c. Has default constructor.. d. Has constructor with one parameter (the capacity). 4. e. Has size () method f. Has append (E element) method. 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.... JUnit tests in the SequenceTest class a. Provides at least one test for each method in the Sequence class for one data type.. b. Provides at least one test for each method in the Sequence class for a second data type... . Design specifications Create a Java project project2 and a package package2. Design the Sequence class with E the type parameter. Define a driver class containing a main method that exercises the class Sequence as an application. The two classes should be saved in different files. Your driver class should have the following header

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions