Please submit the following C++ programs in a zipped file on Canvas: • Template Exercise (50 pts) o Modified FeetInches Specification file (30pts) – FeetInches.h o Driver program with function template (20 pts) – TempDriver.cpp Template Exercise Write template for two functions called minimum and maximum. Each function should accept two arguments and return the lesser or greater of the two values. Test these templates in a driver program. The template with the following types: int, double, string and FeetInches (which is an object). You will need: 1. The FeetInches class (which was provided in Week 5 – Example 2: it is on page 4 of the file). Make changes to the code so that it does the following: 1. Replace the + and – overloaded functions with < and overloaded functions instead. The definition of those functions should take the following form: //Use the function header syntax below bool FeetInches::operator (const FeetInches &right) { // change to proper code create boolean variable
if feet is greater than right.feet Set variable to true otherwise if feet is equal to right.feet and inches is greater than right.inches) Set variable to true otherwise Set variable to false
return Boolean variable } //Repeat and modify for < operator 1. Add the overloaded functions for and << to accept Feet and inches as feet, inches. 3. Examples of overloaded functions were included in Assignment 3. 1. You may not have to modify the operator definition, unless you want to make your input more sophisticated: (Example: You may want to input in ”coordinate form” like (3,7) or you may want the user to type “3 feet, 7 inches”.) • The << operator should be modified to output the comma, the word feet or inches as needed 1. You can omit the simplify function for this exercise. 2. Two template functions (these can be created in your driver program). 3. Variables to store ints, doubles, strings. 4. Objects to store FeetInches values . A sample of the output is shown below: Enter two integers: 1 2 The minimum of 1 and 2 is: 1 The maximum of 1 and 2 is: 2 Enter two floating point numbers: 7.8 4.3 The minimum of 7.8 and 4.3 is: 4.3 The maximum of 7.8 and 4.3 is: 7.8 Enter the first string: Hello Enter the second string: Hullo The minimum of Hello and Hullo is: Hello The maximum of Hello and Hullo is: Hullo Enter the first distance (in feet, inches format): 3, 7 Enter the second distance (in feet, inches format): 4, 9 The minimum of 3 feet , 7 inches and 4 feet , 9 inches is: 3 feet , 7 inches The minimum of 3 feet , 7 inches and 4 feet , 9 inches is: 4 feet , 9 inches