Question: Hi i am taking a java class and I am stuck on this question Consider the class Rational2310 below that represents a rational number using
Hi i am taking a java class and I am stuck on this question
Consider the class Rational2310 below that represents a rational number using its numerator and denominator.
public class Rational2310 {
private int numerator;
private int denominator;
public Rational2310(int numerator, int denominator){
this.numerator = numerator;
this.denominator = denominator;
}
public int getNumerator() { return numerator; }
public void setNumerator(int numerator) { this.numerator = numerator; }
public int getDenominator() { return denominator; }
public void setDenominator(int denominator) { this.denominator = denominator; }
/* add your method reverse here. */
/* add your method multiply here. */
}
In Rational2310, implement static methods that are called reverse and multiply to
(1) reverses a rational number and return the result as a new rational number and
(2) to multiply two rational numbers and return the result as a new rational number.
Submission instructions
1. Copy and paste your Rational2310.java in the provided textbox. All your code must be in this class. Do not submit any other files.
2. Your code should compile and run without any errors.
3. main and test methods should not be submitted and not needed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
