Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add a private simplify() function to your class and call it from the appropriate member functions. (There will probably be 5 places where you need

Add a private \"simplify()\" function to your class and call it from the appropriate member functions. (There will probably be 5 places where you need to call it.) The best way to do this is to make the function a void function with no parameters that reduces the calling object. As you can see from the sample output given below, you are still not required to change improper fractions into mixed numbers for printing. Just print it as an improper fraction. Make sure that your class will reduce ANY fraction, not just the fractions that are tested in the provided client program. Fractions should not be simply reduced upon output, they should be stored in reduced form at all times. In other words, you should ensure that all fraction objects are reduced before the end of any member function. You are also not required to deal with negative numbers, either in the numerator or the denominator. You must create your own algorithm for reducing fractions. Don't look up an already existing algorithm for reducing fractions or finding GCF. The point here is to have you practice solving the problem on your own. In particular, don't use Euclid's algorithm. Don't worry about being efficient. It's fine to have your function check every possible factor, even if it would be more efficient to just check prime numbers. Just create something of your own that works correctly on ANY fraction. Note: this part of the assignment is worth 5 points. If you are having trouble keeping up with the class, I suggest you skip this part and take the 5 point deduction.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions