In this lab you are given a class definition that has a method called
smallest
and method called largest
. Each of these
methods takes four integer parameters, and should return the smallest or
largest of its parameters, respectively.
Unfortunately, both methods are poorly formatted and they both contain bugs.
Your job is to properly indent each of the two methods so that the code is readable, and then identify the bugs. Note that you are not asked to write a correct implementation of either method, but to explain why the version you are given is wrong.
To help you, there are a couple of additional methods that have been provided.
There is a test
method that prints its results. There is also
a randomTest
method that generates random sets of integers
to test. Pressing the "Test" button in the application runs a random test.
You can use the results of random or systematic testing to help you track
down the bugs.