Question: Write a C + + program that performs the rational number operations addition, subtraction, multiplication and division on two fractions. The program should be written
Write a C program that performs the rational number operations addition, subtraction, multiplication and division on two fractions. The program should be written in a single file. You will need to design a "rational number" class named Rational whose value will be a fraction eg or with appropriate constructors and member functions. A fraction will be specified as a numerator and a denominator eg the pair represents the fraction The member variables should be private and accessed using the accessor and mutator functions.
Constructors
Create constructors:
a constructor with two parameters numerator and denominator
a constructor with one parameter denominator set to
a constructor with no parameters
Accessor Functions
add
subtract
multiply
divide
display
Mutator Function
simplify
The following are a list of the rules of arithmetic for fractions:
abcdad bcbd
abcdad bcbd
abcdacbd
abcdadcb
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
