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

USING C++ Modularity: For all arguments indicate pass by value or pass by refere

ID: 3692487 • Letter: U

Question

USING C++

Modularity: For all arguments indicate pass by value or pass by reference.

Write a function called DisplayArizona with no arguments that displays:

*****************

Arizona University

*****************

            Show a sample call.

1. Write a function called CalculatePerimeter that calculates the perimeter when the width and length and perimeter are passed as arguments. Are width and length and perimeter passed by value or reference? Show a sample call.

2. Write a function called Perimeter that calculates the perimeter of a room and returns perimeter when the width and length are passed as arguments. Show a sample call.

3. Write a function called GetDimensions with two arguments width and length that prompts for and receives width and length.

Explanation / Answer

2)

Answer-

int Perimeter(int length, int width)
{
return (2 * length) + (2 * width);
}
Sample call: cout << Perimeter(10, 5)

3)

Answer-

void GetDimensions(int &width, int &length)
{
cout << “Enter width and length” << endl;
cin >> width >> length;
}