JAVA Assignment
INFSCI 2500
Homework 2
The assignment is to implement the methods “insert” and “delete” for our custom collection class Sequence which we built at the end of Lecture 2.
The insert method will take as input int index and E newElement. The method will insert the element into the data array at the specified index. It will then print the elements in the array.
The delete method will take as input int index. The method will delete the element at the specified index. It will then print the elements in the array.
The array should always have just as many spaces as there are elements. Remember to increase or decrease the size field when inserting or deleting.
I have already implemented a print() method for you to use to print the Sequence object out. Call it at the end of each method you write to do the printing.
In the main method, create an instance of the Sequence class and add some integer values with append(). Then write a loop which asks if the user wants to insert or delete or quit from the keyboard. If the user wants to insert or delete, then the loop should ask for the necessary parameters from the keyboard. Below is an example of the functionality expected.
Submit the following:
1. A single java source file “Sequence.java” which includes the class and the main method.
2. A pdf readme file which includes the some sample output you got from your program.
Zip these items together and name it “HW2_Your_Name”. Then submit it on courseweb.
Grading:
2 points: Submitting the source file and pdf with output.
2 points: The source file compiles and runs without errors.
2 points: The program properly implements the insert and delete methods and operates as requested.
This assignment is due September 25 at 5:59 PM. Late submissions will not be accepted!