Question: 4 . Write a C + + program that prompts the user to enter the name, surname, Test 1 mark, and Test 2 mark of
Write a C program that prompts the user to enter the name, surname, Test mark, and Test mark of a student. The program should then use three functions: calculateAverage, gradeAverage, and printDetails as follows:
calculateAverage: This function should take two integer parameters representing the Test mark and Test mark and return the average of the two marks as a double.
gradeAverage: This function should take the average mark as a parameter and return a string indicating whether the student has passed or failed. If the average mark is greater than or equal to the function should return "Passed"; otherwise, it should return "Failed".
printDetails: This function should take the student's name, surname, Test mark, Test mark, average mark, and grade as parameters and display these details to the console. This function is a void function.Write a C program that prompts the user to enter the name, surname, Test mark, and
Test mark of a student. The program should then use three functions: calculateAverage,
gradeAverage, and printDetails as follows:
I. calculateAverage: This function should take two integer parameters representing the
Test mark and Test mark and return the average of the two marks as a double.
II gradeAverage: This function should take the average mark as a parameter and return
a string indicating whether the student has passed or failed. If the average mark is
greater than or equal to the function should return "Passed"; otherwise, it should
return "Failed".
III. printDetails: This function should take the student's name, surname, Test mark, Test
mark, average mark, and grade as parameters and display these details to the
console. This function is a void function.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
