Question: Constructor # 1 - Takes a start value ( must be 1 or greater ) , number of terms ( must be 3 or greater

Constructor #1- Takes a start value (must be 1 or greater), number of terms (must be 3 or greater), and a value for step (must be 1 or greater). If an invalid value is passed in, an IllegalArgumentException will be thrown with the message Invalid parameter and further initialization will not take place. If all the arguments are valid, it initializes the corresponding instance variables and assigns a value to seq (see output for details).
Constructor #2- Takes a start value (must be 1 or greater) and a value for step (must be 1 or greater). If an invalid value is passed in, an IllegalArgumentException will be thrown with the message Invalid parameter and further initialization will not take place. If all the arguments are valid, it assumes the number of terms is five and assigns a value to seq (see output for details).
Copy Constructor - Define a copy constructor for the class.
getStep - Get method for step.
setStep - Set method for step. An IllegalArgumentException will be thrown with the message Invalid parameter and further initialization will not take place if an attempt is made to make step be an integer less than 1. Do not forget to update seq to match the new step value.
getMatchCount - Get method for matchCount.
setMatchCount - Set method for number of matchCount. An IllegalArgumentException will be thrown with the message Invalid parameter and further initialization will not take place if an attempt is made to make matchCount be an integer less than 1.
equals - Define an equals method for the class. In our bizarre definition of sequence equality (do not tell your math teacher about this (), we will assume 2 sequences to be equal if they have at least matchCount terms in common. The placement of terms do not have to match. For example, if matchCount is 3, the sequence 1,2,3,4,55,6 and 2,4,6,8 would be equal because there are at least 3 number (i.e.2,4, and 6) that show up in both sequences. For the same example, the sequences would not be equal had matchCount been set to 4.
compareTo - This method will allow us to compare two aSeq objects. It has a aSeq as parameter and returns an integer. The aSeq compareTo method will return:
a. A negative value if the arithmetic series (sum of the terms in the sequence) of the current object is less than the parameter.
b. A positive value if the arithmetic series (sum of the terms in the sequence) of the current object is greater than the parameter.
c.0 otherwise.
toString - Given to you. Make no changes to this or you will fail the tests.
 Constructor #1- Takes a start value (must be 1 or greater),

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!