Rational fractions are of the form a/b, where a and b are integers and b≠0. Suppose a / b and c / d are fractions. Arithmetic operations on fractions are defined by the following rules:
a/b + c/d = (ad + bc) / bd
a/b – c/d = (ad – bc) / bd
a/b x c/d = (ac)/(bd)
(a/b) / (c/d) = ad/bc, where c/d ≠0
Fractions are compared as follows:
a/b op c/d if ad op bc, where op is any of the relational operators. For example, a/b < c/d if ad < bc.
Design a class, FractionType, that performs the arithmetic and relational operations on fractions. Overload the arithmetic and relational operators so that the appropriate symbols can be used to perform the operation. Also, overload the stream insertion operator and stream extraction operator for easy input and output.
Write a C++ program that uses the FractionType class to perform operations on fractions. Note that your answers do not need to be in lowest terms.
ETP
0
Newbie Poster
Recommended Answers
Jump to PostThe usual rule around here is that you pay us 100 dollars per an hour.
It usually takes us 1-2 hour per homework. So what do you think?
All 2 Replies
mrnutty
761
Senior Poster
jonsca
commented:
That's too conservative of an estimate. First we've got to find yet another forum to repost his question on, wait for that answer, come back, answer the OP's question. That could take a day or two... :)
+2
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.