Question: A sample output could be as follows: Please enter data for 1st ratio: Enter numerator : 4 Enter denominator : 7 Please enter data for

 A sample output could be as follows: Please enter data for1st ratio: Enter numerator : 4 Enter denominator : 7 Please enter

A sample output could be as follows: Please enter data for 1st ratio: Enter numerator : 4 Enter denominator : 7 Please enter data for 2nd ratio: Enter numerator: 27 Enter denominator: 14 Ratio 1 is: 4/7 Ratio 2 is: 27/14 what would you like to do with these ratios? Menu: Press 1 for addition. Press 2 for subtraction Press 3 For multiplication Press 4 for division Press 5 for increment Press 6 for decrement Enter your option: 1 You have chosen addition. The result is: 4/7 + 27/14 = 245/98 = 5/2Create a ratio class that contains the following members: A private data member to store numerator A private data member to store denominator A default constructor that initializes the numerator and denominator to 1. - A constructor with two parameters to initialize the values of numerator and denominator. An overloaded + operator to add two ratio objects. An overloaded operator to subtract two ratio objects. An overloaded * operator to multiply two ratio objects. - An overloaded / operator to divide two ratio objects. An overloaded ++ operator to increment a ratio object. An overloaded operator to decrement a ratio object. An overloaded insertion operator (>) to get numerator and denominator of a ratio object from the user. Design the main( ) function that prompts the user to create two ratio objects. The program will ask the user to choose an operation that user wants to apply on ratio objects and then should print the result accordingly. Increment and decrement operations should be applied on only one object of user's choice (as these are unary operation). After every operation result, the program should ask user if user wants to apply another operation. Simplification of ratio after any operation through greatest common divisor is also required. Your program should also contain the code that will check for and handle errors. A sample output could be as follows

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!