Write a class Fraction with integer numerator and denomi nator data fields. The default value of denomi nator should be 1. Defme a constructor with two arguments for this class and one with just one argument (the value of the numerator). Define a method multiply that multiplies this Fraction object with the one specified by its argument and returns a new Fraction object as its result. Define a method toDeci mal that returns the value of the fraction as a decimal number (be careful about integer division). Define a toSt ring method for this class that represents a Fraction object as a string of the form numerator I denominator.
Write amain method that reads two Fraction objects using class JOpti on Pane. Multiply them and display their result as a fraction and as a decimal number using the instance methods defined in Review Question 4. Use class JOpti on Pane to display the results.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here