hey I was wondering if any of you had an idea for this program I need to write for extra credit in my class. It involves using a rational class which is what Im having trouble writing, I understand if no one wants to take a shot at it, any feedback would be helpful.

Complete an implementation of the Rational class. Your class must have three private data members to represent rationale numbers of the form b a + --- c where a, b and c are unsigned integers, and the relation b < c is always maintained.
Also, c may be constrained to be between 1 and 32, inclusive.
Your class should implement the following:
default constructor.
copy constructor.
initialization constructor with three unsigned ints (a,b,c)
initialization constructor with a signle unsigned int (a)
initialization constructor with a single double (x) // x should be converted into the nearest rational number under the constraints for b and c defined above.
operator+(rational&,rational&);
operator-(rational&,rational&);
operator<<(ostream&,rational&);
operator>>(istream&,rational&);

Recommended Answers

All 3 Replies

Post your most recent attempt. Assuming that you have a basic knowledge of C++, coming up with a starting design wouldn't be that difficult for you.

Hey I can definitely do that, unfortunately I am on a computer that doesn't have my previous file saved in Visual studio, I will have to post it in a new thread once I get to a computer that has that, probably tomorrow or the next day-- thank you for your time though

>I will have to post it in a new thread once I get to a computer that has
>that, probably tomorrow or the next day
Don't start a new thread. Just reply to this one.

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.