Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a new mathematical operation that is critical to the disovery of the Hig

ID: 3545112 • Letter: T

Question

This is a new mathematical operation that is critical to the disovery of the Higgs Boson.

1) Provide the following information about the function: return type, parameters (number and type), what the function does and the overall purpose of the function.

2)Please explain what the function does and the expected result for a value of 7.

double chalupa(int gordita)
{
    double tacoBell=0;
    tacoBell = gordita * 1.534;
    tacoBell = tacoBell +15;
    tacoBell = tacoBell /2;
    return tacoBell;
}

Explanation / Answer

Hello,

Please see the below details about the problem.

Parameters & Function Declaration

------------------------------------------------

1) This function takes the value of gordita from the program/user and calculate the value of tacoBell.

2) This takes an integer parameter to calculate and retuns the tacoBell value.

3) As this function is defined as double, this returns a double value where it get called.

Inside the Function

--------------------------

double tacoBell=0;

1) We have declared a variable called tacoBell and defined it as 0 initially. It is defined as double.

tacoBell = gordita * 1.534;

2) At first we are multiplying the gordita value with 1.543, then we are storing the value into tacoBell.

In your case, if the value of gordita is 7, then the value of tacoBell will be 10.738

tacoBell = tacoBell +15;

3) In this step we are adding 15 to the tacoBell value. The value will now become 25.738

tacoBell = tacoBell /2;

4) Now, based on the above equation the value of tacoBell will become 12.869.

12.869 is the final value which will be returned to the function where it get called.


Below is your example, please try with different inputs for gordita.


#include <iostream>

using namespace std;


double chalupa(int gordita)

{

double tacoBell=0;

tacoBell = gordita * 1.534;

tacoBell = tacoBell +15;

tacoBell = tacoBell /2;

return tacoBell;

}

int main()

{

int gordita1;

cout << "Please enter a value for gordita" << endl;

cin>>gordita1;

double d1 = chalupa(gordita1);

cout<<d1<<endl;

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote