Question
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.
Project # 1Implementation 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 in addition to these instructions. (READ THIS DOCUMENT BEFORE STARTING WORK!) The problem suggests the adding of additional methods. I would like you to add the six of them shown and described below, NOT the ones listed in book. Remember to add in the Javadoc comments for these new methods. 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 these additional six). You should grab a copy of this file to begin work with.
The six additional methods that you need to add should be named the following:
void addFront( double )
void removeFront( )
void setCurrent ( int n )
double getElement ( int n )
boolean equals ( Object )
String toString ( )
As you add each of these methods you need to also add the specifications in the Javadoc comments for each new method.
SequenceTest program:
In order to test your class methods you are going to want a program that creates a sequence object with the ability to call any of the abstract data types (ADT) methods. The Test program that you will create will declare one emptysequence object. Use either of the constructors, setting capacity to 10. Then the program will have a menu output to the screen with the following choices:
Note: for choices 6 and 7 the location to add the new value is referenced to where the current element is. And you will need to ask the user for the number to add.
Note: for choices 9 and 10 the location to display or delete is asked for. This is not an index value, the user will give you a location (the first location is index zero)
NOTE: This test program should never crash due to an exception being thrown from the methods. If the method called from the SequenceTest program might throw an exception, it is your job to catch it in SequenceTest and output an appropriate message. The program should then continue by asking the user pick their next choice.
Exceptions summary: Using exceptions properly is often a point of confusion in this class. The general use of exceptions in this project is to throw them from within the methods of the DoubleArraySeq class, but you do not catch them there. (You catch them in the SequenceTestfile) The designer(you) is attempting to make the DoubleArraySeq class useful for many different projects, and since the many methods could be receiving poor inputs,we want to be able to warn future users of this class with an exception. But we also do not want to assume that we know what should be done in each case of an exception. The Driver class (SequenceTest) is using our class to make a project, this is where we catch and handle any exceptions that are thrown (We can make the assumptions here). There are many ways to program, but we want to make our classes as useful as we can so that there is a greater chance of reusing the ADT later. If you are unsure about this relationship of when to throw and catch exceptions, please ask. Final note: It almost never makes sense to throw and catch an exception in the same method (If that is really what we wish, a simple if statement does the same thing).
These choices will allow the user(me) and you to test your class well. After each choice is finished the menu should pop up again to reshow the choices. PLEASE NOTE: This test program does not check your equals, addAll, or clonemethods, so you will need to test these on your own. Please do not add these extra tests into your submittedversion as I would like to have all submissions working similar.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started