Rational Number class: Create a class called RationalNumber.java. A shell for th
ID: 3537144 • Letter: R
Question
Rational Number class:
Create a class called RationalNumber.java. A shell for this program has been provided.
Create a class called RationalNumberTester.java that tests the class that you just created. In this
class you need to create the following:
1. An array of RationalNumbers of the size 10
2. Create a file with information for 10 different fractions. Make sure to include fractions
that might cause your program to crash such as division by zero. For each line of this file
you provide two numbers like:
a. 4 6 //4 is numerator and 6 is the denominator
b. 34 45 //34 is numerator and 45 is the denominator
c. 34 0
3. Your program will read the file and then fill in the array.
4. Use a random number generator to generate two numbers between 0-9, use these two
numbers to select two fractions from your array.
a. Using the RationalNumber class to use
i. Add //output the fractions and the result
ii. Subtract //output the subtract and the result
iii. Equals //output the comparison result and the fra
Explanation / Answer
Working....
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.