16) Another method that might be desired is one that updates the Student’s number of credit
hours. This method will receive a number of credit hours and add these to the Student’s current
hours. Which of the following methods would accomplish this?
A) public int updateHours( )
{ return hours; }
B) public void updateHours( )
{ hours++; }
C) public updateHours(int moreHours)
{ hours += moreHours; }
D) public void updateHours(int moreHours)
{ hours += moreHours; }
E) public int updateHours(int moreHours)
{ return hours + moreHours; }
17) Consider a Rational class designed to represent rational numbers as a pair of int’s, along with
methods reduce (to reduce the rational to simplest form), gcd (to find the greatest common
divisor of two int’s), as well as methods for addition, subtraction, multiplication, and division.
Why should the reduce and gcd methods be declared to be private.
A) Because they will never be used
B) Because they will only be called from methods inside of Rational
C) Because they will only be called from the constructor of Rational
D) Because they do not use any of Rational’s instance data
E) Because it is a typo and they should be declared as public