Step-by-step Instant Solution
this is a c++ homework
please help me answer this problem
Math 3300 Programming Assignment 7
Instructions: Work on the following 1 programs and submit your source
code to me via Blackboard (you should send only 1 total files (in cpp format).
Do not send your .exe files. This program will test your ability to create classes.
1. Create a class named fraction which will represent a new data type
corresponding to fractions. Your class should create the following private
- Integers n and d corresponding to the numerator and denominator
of the fraction
- A function gcd which returns the greatest common divisor of 2 integers (to help you reduce the fraction).
And the following public member functions:
- 3 constructors which will create any fraction when declared with 2
integers, will create a/1 when declared with 1 integer, and will create
0/1 when declared with no integers.
- num which returns the numerator of the fraction
- denom which returns the denominator of the fraction
- reduce which reduces the fraction to its lowest terms (using the
gcd function above). This function changes the value of n and d
- convert which returns a double representing the fraction (i.e. 3/4
You are to overload the following operators: +, ?, ?, /, + =, ? =, ? =
, / =, <, <=, >, >=, ==, ! = for use with fractions. For the operators
+, ?, ?, /, + =, ? =, ? =, / =, calculate the new fraction in lowest terms
(like 3/4 instead of 6/8). Overload + and ? for both unary and binary
Also overload << and >> to accept and display fractions in the form
a/b. A fraction like a/1 should be displayed as a. You can assume that a
fraction will always be input in the form a/b.
Paper#9255776 | Written in 27-Jul-2016Price : $22