There are three problems in this homework. For each problem, if your program resides in a single file, submit that file into the dropbox in ICON named Homework2; if your program resides in multiple files, submit a zip of those files or of the directory containing those files.

Problem 1

Write a short program that takes as inputs three integers (which we will denote as a, b, and c) from the Java console and determines if they can be used in a correct arithmetic formula (in the given order), line "a + b = c", "a - b = c", or "a * b = c". You will need to read Section 1.6, which we very briefly touched upon, to see how to read from the console.

Problem 2

Write a Java class that extends the Progression class (from Section 2.2) so that each value in the progression is the absolute value of the difference between the previous two values. You should use a default constructor that starts with 2 and 200 as the first two values and a parametric constructor that starts with a specified pair of numbers as the first two values. For convenience of testing, I have placed the code for the Progression class here in the file Progression.java.

It might help to review the Fibonacci Progression class in Section 2.2.

Problem 3

Write a Java program that performs an array reference that is possibly out of bounds, and if it is out of bounds, the program catches that exception and prints the following message: "Don't try buffer overflow attacks in Java!".

For this problem, it will help immensely if you attend your discussion Section on Thursday (9/1).