Question: Write a Java program to read a file that contains lines of CSV. Each line contains a name and a list of grades, separated by
Write a Java program to read a file that contains lines of CSV.
Each line contains a name and a list of grades, separated by commas. Store these values in a two-dimensional array. Then, write a method that takes this array as an argument and calculates the average grade for each student.
Test Cases: Test Case: Given a file with the following content:
John,80,90,70
Jane,85,95,75
Alice,80,70,60
Bob,90,80,70
Our program should print:
John's average grade is 80.0
Jane's average grade is 85.0
Alice's average grade is 70.0
Bob's average grade is 80.0
Hint: Use the split method of the String class to split each line into a name and grades. Then, convert the grades to integers and calculate the average
Step by Step Solution
There are 3 Steps involved in it
Heres a Java program that reads a CSV file stores the data in a twodimensional array and calculates ... View full answer
Get step-by-step solutions from verified subject matter experts
