Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ A rational number is of the form a/b , where a and b are integers, and b is not equal 0. Develop and test
C++ A rational number is of the form a/b, where a and b are integers, and b is not equal 0. Develop and test a class for processing rational numbers.
Details:
- Your program should have 3 files: a driver file to test the operations, a header file for the class definition and any operator overloads you need, and an implementation file with the definitions of the items in the header file.
- The class should read and display all rational numbers in the form a/b,
- except when b is 1, then it should just display a
or when b is 0, then it should display #div0
The operations that should be implemented for the rational numbers are:
Addition |
Subtraction |
Multiplication |
Division |
Invert |
Mixed fraction |
Reduce |
Less than |
Less than or equal to |
Greater Than |
- The arithmetic operators must be overloaded to work with the class
- The class must have
- At least 2 private member variables, numerator and denominator
- At least 4 public member functions
- getNu(), getDe(), setNu(value), setDe(value)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started