Question: Create a File that reads student information( one student per line) name the file Roster.txt , has to count the number of students with a
Fle Edit Fermat View Help " This progr am reads student inf orsation from a file Cone student per, line) e named as roster.txt, counts the number of students with a specific last and writes the student's infornat fon into another file naned as roster-new. Ext :Date: 4/3/2018 package chapters import java. io. sport java.uti. ," publicssainistudert singstring txt2rgs) { public class inputFleroster.txt string string out putrilesane -roster-new, txt "; tryt findstudent (Cinputrile, outputr ilesane catch(FilenotFoundExcept ion ex System, out.print Incex.getmessageO): public static void findstudent (string 1 // create a scanner for the f scanner input - new scanner (new FileCinpute stenane)) // create a printwriter for the out put file intwriter out put new Pr intriter (outputsflesame) create a Scanner for user input scanner scanner- new Scanner (System. in): // Receive user Input en out.print Inc Enter the student's Tast nane: tu aStNane int r-0 runst duents string stuinfo /Lcepeatedly find and save students Into the new file if (stuinfo. contains(stuastsane))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
