Final exam will be given on Monday, December 20, at noon for CPSC 115-01 and
Tuesday, December 21, at 3:00 PM for CPSC 115-02. It will be a closed-book
exam, and no calculator will be allowed. The exam will be comprehensive,
meaning it will cover all of the lectures, reading assignments, laboratories,
homework assignments and quizzes. Roughly speaking, 1/2 of the exam will
emphasize materials covered before Exam 2, and 1/2 will emphasize the recent
materials covered after Exam 2. This review sheet only covers these recent
materials.
A list of particularly important topics
Classes and objects in Java
Methods, parameters and arguments
Inheritance
Polymorphism
One- and two-dimensional arrays
Sorting
Suggested practice exercises
Recall the class Dog from Laboratory 11.
As a subclass of the class Dog, implement a class named
GuideDog to represent guide dogs. This class should contain a
couple of additional fields and methods unique to guide dogs. Implement
the accessor and mutator for each of the fields.
Recall the class Animal from Laboratory 11.
This class has a String field called type. In this class,
add a method named isSameType() that takes an Animal
object in a parameter another and returns true if the
type values of this and another are the same and
false otherwise. To test the equality of two String
objects, say, s and t, invoke s.equals(t).
Implement a method named average() that takes an integer array
in a parameter A and returns the average of all the integers in
A as double.
Recall the class FrequencyAnalyzer from
Laboratory 12. In this class, add a method named
mostFrequent() that returns the FrequencyRecord object
with the highest count among all FrequencyRecord objects in
the array frequencies.
Recall the class FrequencyAnalyzer from
Laboratory 12. In this class, add a method named
selectionSort() that sorts the objects of the array
frequencies by counts using the selection-sort algorithm.
Implement a method named bubbleSort() that takes an array of
Comparable objects in a parameter A and sorts the objects
of A using the bubble-sort algorithm.
An n × n array A is symmetric if
A[i][j] = A[j][i] for all i,
1 ≤ i ≤ n, and j,
1 ≤ j ≤ n. Suppose that you are given an
n × n array A of integers in some class as
a field. In this class, add a method named isSymmetric() that
returns true if A is symmetric and false
otherwise.
Implement a method named areDistinct() that takes an integer
array in a parameter A and returns true if the integers of
A are distinct and false otherwise.
Finally, do not forget to review all the laboratory, homework and quiz
problems. The laboratory, homework and quiz problems are as important as
those given above.