Answer to Question #160949 in C++ for Kefilwe Mamabolo

Question #160949
Study the following function calls and then write the complete function to calculate
and return the answer in an algorithm.
2.1.1 display determineAngle (degrees)
The function must determine and return the results if an angle is equal to 90
degrees, display the message “The angle is a right angle”; else display the
message “The angle is not a right angle”.
2.1.2 If getResults(summative1, summative2) = true
The function must determine and return results to indicate if the student has
passed or not. The student will pass the module if the final mark of one of the
summative test mark is 50 and above.
2.2 Study the following sub procedure calls and then write the complete sub procedure in
both algorithm and ++ syntax to calculate and return the answer.
2.2.1 call CalcAreaPeri(length, width, area, perimeter)
The sub procedure must calculate the area and perimeter for the rectangle which
must be accessible by the calling module. Write the complete sub procedure for
this problem.
2.3 Write the function or sub procedure and the function and/or procedure call for the
following:
2.3.1 The function must determine and return the results if the two values sent to it are
even or not. Use a selection control structure in your call statement.
2.3.2 There are three players in a match, they all have different scores. The function
must determine the best player and the name for the best player. The best player
must have 150 or more points. The calling module must display the name and the
1
Expert's answer
2021-02-03T11:18:01-0500
2.1.1
void determineAngle(float degrees)
{
	if (degrees == 90)
	{
		cout << "The angle is a right angle\n";
	}
	else 
	{
		cout << "The angle is not a right angle\n";
	}
}
2.1.2
bool getResults(int summative1, int summative2)
{
	bool a = false;
	if (summative1 > 50)
	{
		a = true;
	}
	if (summative2 > 50)
	{
		a = true;
	}
	return a;
}
2.2.1
void CalcAreaPeri(int length, int width,int& area,int& perimeter)
{
	area = length * width;
	perimeter = 2 * (length + width);
}
2.3.1
bool EvenOrOdd(int num1, int num2)
{
	bool a = false;
	if ((num1 % 2 == 0) && (num2 % 2 == 0))
	{
		a = true;
	}
	return a;
}
2.3.2
void Match(string nam1, int scor1, string nam2, int scor2, string nam3, int scor3)
{
	int a[3] = { scor1, scor2, scor3 };
	string n[3] = { nam1,nam2,nam3 };
	int j = 0;
	for (int i = 1; i < 3;i++)
	{
		if (a[i] > a[j])
		{
			j = i;
		}
	}
	if (a[j] > 150)
	{
		cout << "Name: " << n[j] << " score: " << a[j] << endl;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog