Answered You can hire a professional tutor to get the answer.

QUESTION

Add two constructors to your fraction class. One should be a default constructor which creates the fraction 0/1. The other should accept numerator...

1. Add two constructors to your fraction class. One should be a default constructor which creates the fraction 0/1. The other should accept numerator and denominator arguments.

2. Add a method dblValue to your fraction class which returns the double precision approximate value of the fraction. Eg, if a client has a fraction f which represents 1 / 2 then f.dblValue() should return the double number 0.5.

3. Add a private method simplify to your fraction class which converts the fraction to its simplest form. For example, the fraction 20/60 should be stored as 1/3.

4. Add a toString method to your fraction class which returns the fraction as a String in the form “x/y”, where x and y are numerator and denominator respectively.  

5. Write a client program which allows the user to add up any number of non-zero fractions. The program should display the running total as an exact fraction (in simplified form as x/y) and as an approximate double value. The user can finish by entering a fraction which represents zero.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question