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.
Computer Science & Information Technology
You might also like to view...
What information does the title bar of Office 2010 contain?
A) The file name and the application B) The application and the drive C) The file name and the drive D) The file name, folder name, and drive
Computer Science & Information Technology
Layered defense for securing facilities is both physical and __________.
A) alarmed B) psychological C) monitored D) structural
Computer Science & Information Technology