a class Rational for performing arithmetic with fractions. Write a driver program to test the class. Provide a constructor that enables an object of this class to be initialized when it is instantiated. The constructor should contain default values in case no initializes are provided and should store the fraction in reduced form. Provide a private function to reduce numbers. Provide Public member functions for each of the following arithmatic’s functions (addition – subtraction – multiplication – division), printing in the form a/b, printing in floating point format and final overload the == and != operators to allow comparisons of two fraction numbers. Include any additional operations that you think would be useful for a rational number class. Design, implement, and test your class.
1- Create a class Rational for performing arithmetic with fractions.
Write a driver
enables an object of this class to be initialized when it is
instantiated. The constructor should contain default values in case
no initializes are provided and should store the fraction in reduced
form. Provide a private function to reduce numbers.
Provide Public member functions for each of the following
arithmatic’s functions (addition – subtraction – multiplication –
division), printing in the form a/b, printing in floating point format
and final overload the == and != operators to allow comparisons of
two fraction numbers.
Include any additional operations that you think would be useful for
a rational number class.
Design, implement, and test your class.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images