Create a class Rational that represents a rational number. It should have private attributes for
• The numerator (an integer)
• The denominator (an integer)
and the following methods:
• Rational(numerator, denominator)—a constructor for a rational number.
• Accessor methods getNumerator and getDenominator and mutator methods setNumerator and setDenominator for the numerator and the denominator. You should use an exception to guarantee that the denominator is never zero.
See the code in Rational.java.
You might also like to view...
The Q in SQL stands for Structured ________ Language
A) Question B) Quiz C) Query D) Quick
The ____ function sums the numbers in the specified range and then divides the sum by the number of cells with numeric values in the range.
A. MIN B. SUM C. AVERAGE D. MAX
A star topology is most closely associated with
A) Novell networks B) Gateway networks C) Bus networks D) Ethernet networks
When you place an if statement within another if statement, ____.
A. a syntax error is generated B. curly braces are required C. you create a switch statement D. you create a nested if statement