Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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