Question
A VALUE_RETURNING FUNCTION: Choose one of the following set of programming exercises below for this portion of the algorithm workbench exercise (5 points) (A) Set-up
A VALUE_RETURNING FUNCTION: Choose one of the following set of programming exercises below for this portion of the algorithm workbench exercise (5 points) (A) Set-up and implementation code for a value-returning bool function Equals You are not required to write a complete C++ program but must write your responses to the specific function related questions below: QA1: Write the heading for a value-returning bool function called Equals that has two value float parameters, x and y. Document the data flow of the parameters with appropriate comments*. QA2: Write the function prototype for the function in QA1. QA3: Write the function definition of the function in QA1 so that it compares x and y, returning true if their difference is less than 0.000000001, and false QA4: Add comments to the function definition* you wrote in QA3 that also states its precondition and postcondition. OR (B) Set-up and implementation code for a value returning float function ConeVolume QB1: Write the heading for a float value returning function called ConeVolume that takes two value float parameters, radius and height. Document the data flow of the parameters with appropriate comments*. QB2: Write the function prototype for the function in QB1. QB3: Write the function definition of the function in QB1 so that takes the two incoming parameters and computes the volume of a cone using the following formula: 1/3pi x radius2 x height QB4: Add comments to the function definition* you wrote in QB3 that also states its precondition and postcondition. ----------------------------------------------------------------------------------------------------------- A VOID FUNCTION: Choose one of the following set of programming exercises below for this portion of the algorithm workbench exercise (5 points) (C) Set-up and implementation code for a void function Max You are not required to write a complete C++ program but must write your responses to the specific function related questions below: QC1: Write the heading for a void function called Max that has three int parameters: num1, num2 and greatest. The first two parameters receive data from the caller, and greatest is used to return a value as a reference parameter. Document the data flow of the parameters with appropriate comments*. QC2: Write the function prototype for the function in QC1. QC3: Write the function definition of the function in QC1 so that it returns the greatest of the two input parameters via greatest, a reference parameter. QC4: Add comments to the function definition* you wrote in QC3 that also states its precondition and postcondition. OR (D) Set-up and implementation code for a void function GetLeast QD1: Write the heading for a void function called GetLeast that takes an ifstream parameter called infile as an input parameter that is changed, and that has an int parameter called lowest that is used to return the lowest value as a reference parameter. Document the data flow of the parameters with appropriate comments*. QD2: Write the function prototype for the function in QD1. QD3: Write the function definition of the function in QD1 so that it reads all of infile as a series of int values and returns the lowest integer input from infile. QD4: Add comments to the function definition* you wrote in QD3 that also states its precondition and postcondition. *NOTE: an additional 10 points extra credit will be provided if you include appropriate function documentation in the two functions you selected from the list above. For more on function header, data flow and other function related documentation see the following class handout:
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