Fill This Form To Receive Instant Help
Homework answers / question archive / Create a class called FrectM
Create a class called FrectM. performing arithmetic functions with fraction. You will separate the interface h)frorn the implementation (cpp) You have be. provided wit a d.er/client program.. will use this class You have also been provided a NIRtles.M1 file which contains the gal, simplify and lcm (least common pie) functions. Fractions have the form Numerator/ Denominator and will always be stored/displayed some reduced form 1 Implement the Function class. • Frection.M1- Class declaration (provided foryou) • Frection.ct,- Class definition Use irrt variables to represent the private data ofthe class. There are only two p.ate mem to the numerator and an int to represent the denominator (a) Provide the following constructors: default constructor- give in,dal values., 0 tor the nurnerator and for Ale denominator peremetedzed oonstructor - give in,dal values.the numerator and denominator from the constmotor parameters. If the denominator is 0, use the default values forthe numerator and denominator. Simplify the fraction. copy constructor - initial values from an object Mat already exists conversion constructor -converts a v.tor of Ilvo ints into a Function Initial value for numerator will be the first int in the vector and initial value for denominator is seoond int in the vector. (b) Provide a or (c) Provide the following overloaded operators:
(d) Overload.. and operators The., operator will print cute Fraction in the form numerator/denominator Llse this operator. OM out tractions. the screen llse the a,operafor to Input tractions from the keyboard (e) Provide implementations forthe following functions bool IsOefault( const,retums false a numerator and denominator were entered (numerator, 011 denominator //returns true default then no numerator or denominator were entered .0..00 cos, //returns., representative &traction, numerator-,and denominator.. 5, returns as
//These-functions are used tor testing, and are provided tor you void senaction(int numerator,. denominator), int getNumerator0 cns, int getDenorminator0 cons, vector getFractionO,
Already member? Sign In