For example, if p is 12, and inc is 5, then the progression is [ 0, 5, 10, 3, 8, 1, 6, ...]. Notice that such a progression can also be defined in the following way. Its first element is 0. If the current element of the proression is cur, then its next element is (cur + inc) mod p.
You should use a default constructor that sets 5 and 12 as the values of inc and p, respectively. You should also define a parametric constructor that sets inc and p to the pair of numbers given as input to the constructor. One requirement is that you should not override the printProgression method in the Progression class, but it should nevertheless work correctly on a ClockArithProgression object. For convenience of testing, I have placed the code for the Progression class here in the file Progression.java. (4 points)
It might help to review the Arithmetic Progression class in Section 2.2, which can also be found here.
This java program performs an array reference that is out of bounds in one of the executions of the assignment statement
sum = sum + myArray[i];If you run the program, it throws an exception when this out of bounds reference happens. Wrap that assignment statement within a try-catch block so that the resulting program catches that exception and prints the following message: "You are accessing an index that is out of bounds!". (3 points)
For this problem, it will help immensely if you attend your discussion Section on Thursday (9/12). Note that to solve this problem you do not have to define and throw an exception.
The source code for this homework needs to be submitted into a dropbox called Homework2 in ICON. Problems A and B are in the same package, so you can submit all the .java files in that package as your combined solution to these problems. For Problem C, you need to submit the .java files in package fall13hw2c: most likely, this will be the file Fall13HW2C.java, suitably modified. The homework is due Wednesday, September 18, at 11:59 pm.