The fraction class in my opinion is one of the most invaluab

The fraction class, in my opinion is one of the most invaluable classes to build as a new object-oriented programming student. Why? It requires the management of the components of a rational number like the integer, numerator and demoninator. Performing math operations on two or more fractions require some thinking outside of the box strategies because of the various math rules that need to be followed.

In this discussion forum, share with your classmates a descriptive listing of five class methods that you think are required to make a fraction class meaningful and robust.

By Wednesday night, for each class method provide the required parameters, detailed description of what the function should do and an example of the function call in main. (50 points)

Solution

The fraction class, in my opinion is one of the most invaluable classes to build as a new object-oriented programming student. Why?

A fraction class is a collection of multiple parts at low level, but as an abstract, it will be seen as a single value, and the operations usually will be performed as a whole at the abstract level, but in-turn every operation should be done on parts of the fraction. This is the reason why its an invaluable class to build an object oriented programming.

Usually, the fraction is a collection of 2 parts, a numerator and a denominator, or a mixed fraction is a collection of 3 parts, the whole number, the numerator, and the denominator, which can be converted into proper fraction.

The methods which could be implemented on Fraction class include:

addition(): Which takes 2 fractions, and returns the sum of those fractions as output.

subtraction(): Which takes 2 fractions, and return the resultant fraction such that the second fraction is subtracted from the first.

multiplication(): Which takes 2 fractions, and return the product of both those fractions as output.

division(): Which takes 2 fractions, and returns the quotient of the first fraction divided by second.

isInfinite(): Which takes a fraction as input, and returns a boolean value true, if the denominator is 0, and false otherwise.

The fraction class, in my opinion is one of the most invaluable classes to build as a new object-oriented programming student. Why? It requires the management o

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site