A fraction has a numerator and a denominator. Consider the class Fraction of such numbers. Suppose that the Fraction class represents the numerator and denominator as integers. For example, the...


A fraction has a numerator and a denominator. Consider the class Fraction of such numbers. Suppose that the Fraction class represents the numerator and denominator as integers. For example, the fraction 3/7 would be stored as 3 in the numerator and 7 in the denominator.


a. Write specifications for a method within the Fraction class that adds two fractions. Include the statement of purpose, the preconditions and post-conditions, a description of the arguments, and a description of any return value.


b. Write a C++ implementation of this method. Design and specify any other method that you need. Include comments that will be helpful to someone who will maintain your implementation in the future.

Nov 16, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here