I need to write a C++ program to test for a class named Rational for performing arithmetic function.
Here’s the layout:
* use integer variable to represent the private instances variables of the class. The numerator %26amp; denominator e.g. fraction 2/4=1/2
*provide a constructor that enables an object of this class to be utilized when it is declared.
* provide public functions (methods) that perform each of the following:
(a) add 2 rational numbers, the result of their addition should be in reduced form
(b) Print rational numbers in the form a/b, (a is numerator, b is denominator)
(c) Multiply 2 rational numbers.
Thanks
P.S. the answers shouldn't be decimal but still fraction
Need help on C++ program for simple division?
If you're looking for someone to do all your homework for you, well, good luck. Is there a particular part of this that's causing you trouble, or do you feel like you have no idea where to even start?
By the way, cplusplus.com is a pretty good reference and might help you.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment