Question
Exercise 2. You will create a file where each line represents a student (their first name and last name) and four lab marks (all integers
Exercise 2. You will create a file where each line represents a student (their first name and last name) and four lab marks (all integers out of 10). You need to read the lines from this file using a Scanner object and then reformat the data and write the data using a PrintWriter object (students last name, first name with their average lab mark) in a new file. At the bottom of the new file also print the number of students and the average lab mark for the entire class. Below, you can see the unformatted text in Students.txt and the formatted text in Formatted.txt.
Exercise 2. You will create a file where each line represents a student (their first name and last name) and four lab marks (all integers out of 10). You need to read the lines from this file using a Scanner object and then reformat the data and write the data using a PrintWriter object (students last name, first name with their average lab mark) in a new file. At the bottom of the new file also print the number of students and the average lab mark for the entire class. Below, vou can see the unformatted text in Students.txt and the formatted text in Formatted.txt. Formatted.txt (after formattin Name dents.txt (before formatting Lorri Black 10 9 7 6 Jim Liam 10 9 9 8 Clem Pint 7 6 8 7 Steve Clark 3 7 9 0 Sara Term 8 10 9 10 Pete Song 9987 Stu Ave Lab Mark Black, Lorri 8.0 Liam, Jim Pint, Clem 7.0 Clark, Steve 4.75 Term, Sara 9.25 Song, Pete 8.25 9.0 Total Students: 6 Average lab class: 7.5Step 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