#C12816. Average Student Scores Calculation
Average Student Scores Calculation
Average Student Scores Calculation
This problem requires you to calculate the average score for each student based on scores in four subjects: Math, Science, English, and History. Each student record is provided in CSV format from standard input. If a score is missing or non‐numeric, treat it as 0 when computing the average. The average is calculated using the formula: \(\text{Average} = \frac{\text{Math} + \text{Science} + \text{English} + \text{History}}{4}\).
If the input CSV does not contain all the required columns (Name, Math, Science, English, History), the program should produce no output.
inputFormat
The input is read from standard input and consists of CSV formatted text. The first line is the header which should include exactly the following columns: "Name,Math,Science,English,History". Each subsequent line contains a student's record with their respective scores. Values may be missing or invalid; in such cases, consider them as 0 for the average calculation.
outputFormat
For each student, output a single line that contains the student's name followed by a space and then their average score, rounded to two decimals. If the CSV header is missing any of the required columns, no output should be produced.
## sampleName,Math,Science,English,History
Alice,90,85,88,92
Bob,78,82,invalid_data,89
Charlie,95,93,91,94
Daisy,,75,80,85
Evan,80,non-numeric,79,78
Alice 88.75
Bob 62.25
Charlie 93.25
Daisy 60.00
Evan 59.25
</p>