CSC220 Lab Number 2
Due: 11:59PM, Tuesday, September 15
Download the following file:
The ExTest has a main method. Upon invocation it shows on the screen
GUI for selectig methods. It reads from a two-dimensional table of integers
and execute a selected binary or uniary operation on selected
entries. Here are some characteristics of the program:
-
Table
-
Initially no table is read.
-
A table can be read from a file.
The format is that the rows are separated by a new line and the columns
are separated by a horizontal TAB.
-
There is no check for an incorrect format, so if a file given in an
incorrect format, the program is likely to quit.
-
Using a button that says "Random Table" it is possible to produce
a file of random entries, where at a certain rate an empty entry
appears. (At most 20x20 in size and each entry nonnegative and
less than 10000.)
-
Operations.
-
Allowable binary operations are +, -, *, and /.
-
Allowable unary operations are sin, cos, tan, and log.
-
When 0 is given as the second argument for /
and when 0 is given as the argument for log,
the program quits because of an error.
The tasks of this exercise are embedded in the code itself.
There are four of them.
-
Supplement the existing catch clauses in the file reading part
so that the case in which the file is empty in the first line
is dealt with allowing the program to continue.
-
Modify the file reading part so that a too long line is truncated
and a too short line is supplemented with extra 0 entries .
Add a catch clause to deal with the case in which an entry doesn't
have an integer entry (including the case when the entry is empty).
-
Add a catch clause or any appropriate measure to deal with the case
in which the divising entry is 0 for /.
-
Add a catch clause or any appropriate measure to deal with the case
in which zero or a negative value is given for log.