Question: This project can be done by one or two students. No groups of three without the instructors permission. If working as a group, make sure
This project can be done by one or two students. No groups of three without the instructors permission. If working as a group, make sure that both of you understand all aspects of the assignment. Note: If the work is not evenly done, this will no doubt be seen during exams. Project # 1 Implementation of DoubleArraySeq class Your task is to create the class that is discussed in chapter 3, section 3.3 of your textbook. The assigned project in the back of the chapter is #4 on page 169. You must also add the six methods suggested in the problem which are described below. Plus, you are to add the methods equals and toString to the class. Lastly you must create a Test class that allow the user to create sequences and manipulate them using your class. This is also described below. Along with this document in the assignments folder should be a file called DoubleArraySeq.java which contains the template of the class along with all written specifications for the methods (except for the additional eight) You should grab a copy of this file to work off of. The eight additional methods that you need to add should be named the following: void addFront( double ) A method to add a new element at the front of the sequence and make it the current element. void removeFront( ) A method to remove the element at the front of the sequence. If there is a next element, make that element the current element. Throw an IllegalStateException if the sequence is empty void addEnd ( double ) A method to add a new element at the end of the sequence and make that element the current element void setCurrentLast( ) A method that makes the last element of the sequence the current element Throw an IllegalStateException if the sequence is empty double getElement ( int n ) a method that returns the n th element of the sequence, and make current element to the n th element(n does not represent the array location) Throw an IllegalStateException if the sequence is empty, or if n is greater than the sequence size void setCurrent ( int n ) a method that makes the n th element become the current element Throw an IllegalStateException if the sequence is empty, or if n is greater than the sequence size boolean equals ( Object ) a method that returns true if sequence is the same length and order and data, current element could be different. String toString ( ) Outputs all elements in order separated by a space Throw an IllegalStateException if the sequence is empty As you add each of these methods you need to also add the specifications in the Javadoc comments for each new method. The Test program will declare two sequence objects, sequenceA and sequenceB. Use each of the constructors once, capacity of second one is 5. Then the program will have a menu output to the screen with the following choices: 1. Print the sequences of A and B 2. Report the capacity of A and B 3. Report if A and B are equal 4. Change active sequence (default is A) 5. Add a number to the front of a sequence 6. Add a number before a given number(user inputted) 7. Add a number after a given number(user inputted) 8. Add a number to the end of a sequence 9. Add sequence B to end of A 10. Delete a number at a certain index 11. Delete the first number from the sequence 12. Display a number at a certain index 13. Display the last element in the sequence 14. Create a new sequence using concatenate of B and A and show 15. Quit T
Step by Step Solution
There are 3 Steps involved in it
The provided text seems to be an assignment prompt for a programming class project The details appear complete as the task involves implementing a cla... View full answer
Get step-by-step solutions from verified subject matter experts
