Question: Write a program in C++ with the following requirements: 1- Create the class Fraction (this class will have two member variables of type int): a)

 Write a program in C++ with the following requirements: 1- Create

Write a program in C++ with the following requirements: 1- Create the class "Fraction" (this class will have two member variables of type int): a) The class must have 3 constructors: default, with parameters using initializer list, and the copy constructor. b) The class should overload the assignment (=) operator. c) The class should have "get" and "set" methods for the member variables. d) The class should have the functionalities: addition, subtraction, multiplication, and division. e) The class should have the method print() that prints the fraction. f) The class should have the method simplify() which will reduce the resulting fraction to the lowest terms. 1- Write the main function in a separate file where you will implement the logic of a calculator over "Fraction" objects only for the functionalities that are implemented in "Fraction" class. For example, you can create three objects from the class "Fraction" where the first object will hold the first fraction, the second object will hold the second fraction, and the third object will hold the result. The operations that will be used over the objects, need to be chosen by the user (ex: user will enter A for Addition and D for Division and so on...). It is recommended to use the "switch" statement to check the operation entered. The program will end when the user enters E (meaning exit). It is recommended to use "while" or "dowhile" loop to control the termination of the program

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!