Question
The following information, located on Github m03, are provided as a starter. Frac.h, a complete Frac Class Declaration ( the definition is to be complete
The following information, located on Github m03, are provided as a starter.
- Frac.h, a complete Frac Class Declaration ( the definition is to be complete by you.)
- testFrac_starter.cpp, a working program with partial Frac members defined to get you started.
Please follow the TODO List below to finish all Class definitions, and to expand the starter to exercise and verify all the Frac member methods.
Project Requirement
The form and format the Fractional number to be used
In this project, We are only going to
(1) use two numbers: numerator over denominator to represent a fraction, no mixed numerals.
(2) allow the usage of the proper and improper fraction:
- Proper Fraction: the number is inferior to the denominator, for instance 3/4 ;
- Improper fraction: the numerator is superior to the denominator, for instance 9/2 ;
We are not going to use Mixed Fraction and Equivalent Fractions:
- Mixed Fraction or Mixed Numeral: it is composed of a whole part and a fractional one, for instance 2 1/3 ;
- Equivalent Fractions: fractions that keep on the same proportion of another fraction, for instance: 5/2 =10/4; All Fraction shall be the minimum number representation.
Part-2
Sequence of operations in 1 statements vs. 6 statements 5 pts
To include the Special ++/-- Test Pattern (inside the testFrac_starter.cpp) as part of your final test program.
// line #74 onward cout << " Please observe the outputs of identical commands " << " executed in one statement v. separated statements. "; Frac f(5,6); cout << f << " " // start << --f << " " << f << " " << ++f << " " << --f << " " << ++f << endl; // end of one statement cout << f << " " ; cout << --f << " " ; cout << f << " " ; cout << ++f << " " ; cout << --f << " " ; cout << ++f; cout << " Why the above output values are not the same? ";
After successfully implemented and executed your program:
Final Check List
- To complete all method's definition based on the following member method declaration of the Frac Class for Project 1. (the declaration only Frac.h in Github m03 folder)
- Complete the testFrac.cpp program (testFrac_starter.cpp is provided in Github). Please expand the tester to make sure all the Frac member methods are verified with your own tester.
- Make sure no error or any unverified member methods (point deduction)
- Provide the reason/explanation on why the increment/decrement test sequence (one statement vs 6 statements) produce different outcome.
Submit
- testFrac.cpp (a starter is provided in Github)
- Frac.h or you may combine into one single testFrac.cpp
- Verification (All Frac class members test requirement 1-6 must be tested)
- Explanation of the different output pattern on running the special ++/-- test provided for this project.
Part-2 (5 pts) for the explanation for the behavior observed by running the provided test pattern:
six (6) operations in one statement vs. six (6) operations in six (6) statements.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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