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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!