Question
A. public class Frac { // constructor that takes 2 integer arguments, a numerator and denominator public Frac(int num, int denom) { // TODO: implement
A.
public class Frac {
// constructor that takes 2 integer arguments, a numerator and denominator
public Frac(int num, int denom) {
// TODO: implement this constructor
}
// constructor that takes a floating-point number and converts it into the appropriate rational number
public Frac(double d) {
// TODO: implement this constructor
}
// member function that converts the fraction to a floating-point number
public double toDouble() {
// TODO: implement this function
}
// member functions which implement the basic arithmetic operators for any two rational numbers
public Frac add(Frac other) {
// TODO: implement this function
}
public Frac subtract(Frac other) {
// TODO: implement this function
}
public Frac multiply(Frac other) {
// TODO: implement this function
}
public Frac divide(Frac other) {
// TODO: implement this function
}
}
Explanation:
B. public class Frac { // constructor that takes 2 integer arguments, a numerator and denominator public Frac(int num, int denom) { // TODO: implement this constructor } // constructor that takes a floating-point number and converts it into the appropriate rational number public Frac(double d) { // TODO: implement this constructor } // member function that converts the fraction to a floating-point number public double toDouble() { // TODO: implement this function } // member functions which implement the basic arithmetic operators for any two rational numbers public Frac add(Frac other) { // TODO: implement this function } public Frac subtract(Frac other) { // TODO: implement this function } public Frac multiply(Frac other) { // TODO: implement this function } public Frac divide(Frac other) { // TODO: implement this function } } C. public class Frac { // constructor that takes 2 integer arguments, a numerator and denominator public Frac(int num, int denom) { // TODO: implement this constructor } // constructor that takes a floating-point number and converts it into the appropriate rational number public Frac(double d) { // TODO: implement this constructor } // member function that converts the fraction to a floating-point number public double toDouble() { // TODO: implement this function } // member functions which implement the basic arithmetic operators for any two rational numbers public Frac add(Frac other) { // TODO: implement this function } public Frac subtract(Frac other) { // TODO: implement this function } public Frac multiply(Frac other) { // TODO: implement this function } public Frac divide(Frac other) { // TODO: implement this function } } D. public class Frac { // constructor that takes 2 integer arguments, a numerator and denominator public Frac(int num, int denom) { // TODO: implement this constructor } // constructor that takes a floating-point number and converts it into the appropriate rational number public Frac(double d) { // TODO: implement this constructor } // member function that converts the fraction to a floating-point number public double toDouble() { // TODO: implement this function } // member functions which implement the basic arithmetic operators for any two rational numbers public Frac add(Frac other) { // TODO: implement this function } public Frac subtract(Frac other) { // TODO: implement this function } public Frac multiply(Frac other) { // TODO: implement this function } public Frac divide(Frac other) { // TODO: implement this function } } E. public class Frac { // constructor that takes 2 integer arguments, a numerator and denominator public Frac(int num, int denom) { // TODO: implement this constructor } // constructor that takes a floating-point number and converts it into the appropriate rational number public Frac(double d) { // TODO: implement this constructor } // member function that converts the fraction to a floating-point number public double toDouble() { // TODO: implement this function } // member functions which implement the basic arithmetic operators for any two rational numbers public Frac add(Frac other) { // TODO: implement this function } public Frac subtract(Frac other) { // TODO: implement this function } public Frac multiply(Frac other) { // TODO: implement this function } public Frac divide(Frac other) { // TODO: implement this function } // method which reduces a fraction to its simplest form public Frac reduce() { // TODO: implement this function } }
Step 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