Is a rational number is in the form A / B with a numerator and the denominator b. For example, 1/2, 3/5 and 8/2 are rationale
numbers. The denominator of a rational number can not be equal to 0, but the counter can be 0.
Is a rational number can not always be exactly represented in floating-point format,
for example, 1/3 = 0.33333. . ..
Java provides data types for integers and doubles, but not for rational numbers. Therefore you are requested
design, that rational numbers can be saved. Fracture object as a class Fraction for
representation of rational numbers we use a numerator and a denominator. The counter can include all whole numbers,
and the denominator must be a whole number greater than 0.
Write a Break in the class file [url removed, login to view] with the following attributes:
• Two integer instantiation variables numerator and denominator.
• Four different constructors, each with different parameters. Note that in the constructor with two parameters
must be determined whether the denominator is greater than 0 tested. If the denominator is less than zero, have to numerator and denominator
multiplied by -1. are. It must be the fault stored in simplified form, ie as
we specify the numerator and the denominator 2 12, we want to save the fraction 1/6.