Question: c++ program . comment and explain the formula 7. (20 points) Write a class named Rat (to simulate rational or fraction number) such that it

c++ program . comment and explain the formula c++ program . comment and explain the formula 7. (20 points) Write

7. (20 points) Write a class named Rat (to simulate rational or fraction number) such that it works as in the main below. int main() { Rat a(3, 4), (1, 2); a.print(); // output: 3/4 b.print(); // output: 1/2 Rat c-a.add(b): c.printo: // output: 5/4 // Hint: 3/4 + 1/2 - 6/8 + 4/8 - 10/8 - 5/4 Rat d = a.multiply(b); d.print(): // output: 3/8 // Hint: 3/4 x 1/2 - 3/8 return 0

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 Databases Questions!