Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Returning objects from classes, methods, and constructors If you could explain how to return the various functions of the object fraction that would be helpful
Returning objects from classes, methods, and constructors
If you could explain how to return the various functions of the object fraction that would be helpful as well as sample code and a recommendation on how to get the greatest common denominator. The first image is the file the code is being tested with so the methods cannot change and the only requirement is that the return methods are one liners.
1% FractionTester.java A program that declares Fraction variables We will test your Fraction class on THIS tester. public class FractionTester public static void main String args [1) // use the word Fraction as if were a Java data type Fraction f1 new Fraction( 44,14); // reduces to 22/7 System.out.println "fl"f1; // should output 22/7 Fraction f2 new Fraction 21,14);I/ reduces to 3/2 System.out.println "f2" f2; // should output 3/2 System.out.println( f1.add f2 // should output 65/14 // System.out.println( f1.subtract( f2); // should output 23/14 /System.out.println( f1.multiply f2)): 1/ should output 33/7 // System.out.println( f1.divide f2)); // should output 44/21 /System.out.println( f1.reciprocal);// should output 7/22 / END main // EOFStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started