Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Constructor # 1 - Takes a start value ( must be 1 or greater ) , number of terms ( must be 3 or greater
Constructor # Takes a start value must be or greater number of terms must be or greater and a value for step must be 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 # Takes a start value must be or greater and a value for step must be 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 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
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 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 the sequence and would be equal because there are at least number ie and that show up in both sequences. For the same example, the sequences would not be equal had matchCount been set to
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 otherwise.
toString Given to you. Make no changes to this or you will fail the tests.
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