Question
Building a class for Fraction ADT (20 points. submit your two source files named Frac.cpp and Frac.h online only before the due time next week)
Building a class for Fraction ADT (20 points. submit your two source files named Frac.cpp and Frac.h online only before the due time next week)
Create a class called Fraction for performing arithmetic with fractions. Use integer variables to represent the private data of the classthe numerator and the denominator. Provide a constructor function that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initializers are provided. Provide public member functions for each of the following: a) Addition of two Fraction numbers. See the solution as an example below. b) Subtraction of two Fraction numbers. c) Multiplication of two Fraction numbers. d) Division of two Fraction numbers. e) Printing Fraction numbers in the form a/b where a is the numerator and b is the denominator. f) Printing Fraction numbers in double floating-point format.
Note: 1. You just need to finish the skeleton codes in two files: the interface Frac.h and the implementation file Frac.cpp. 2. A driver program (do not change it!) to test your class: LabProj4Driver.cpp. 3. For submission, you need to upload the two source files: your Frac.h and Frac.cpp to Canvas (please DO NOT zip them).
Driver program
#include "Frac.h" #include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started