Exercise : if
/else
Factoring
-
Download the following program
to your machine and open it with jGrasp.
-
The program's method is redundant. Factor the method,
restructuring the code to eliminate unnecessary statements while
retaining the same behavior.
-
Insert some test calls of the method
in
main
and run it to make sure it works properly.