Monday, July 27, 2009

Need help to create class?

Need help to create this class:





Create a class in C++ named Fractions having two integer data members named for a fraction’s numerator and denominator. The class’s default constructor should provide both data members with default values of 1 if no explicit user initialization is provided. The constructor must also prohibit a 0 denominator value. Additionally, provide member functions for displaying an object’s data values. Also provide the class with overloaded operators that are capable of adding, subtracting, multiplying, and dividing two Fraction objects according to following formulas:








Sum of two fractions: a/b + c/d = ad+cb / bd





Difference of two fractions: a/b - c/d = ad-cb / bd





Product of two fractions: a/b * c/d = ad / bd





Division of two fractions: a/b / c/d = bd / cd

Need help to create class?
Oh for Gawd's sake. Google "fraction class c++". The very first hit gets lots of code so you don't have to do your homework, project, or exam by your very own self. The skill of googling will serve you well on your first job so you don't have to do your own work by your very own self.


No comments:

Post a Comment