Question: JAVA The code will be written in accordance with the second image. This assignment will give you practice with fine based file procossing and scarner


This assignment will give you practice with fine based file procossing and scarner methods. Modify the Hours program we did in class. You are going to write a program that allows the user to search for a person by ID. Your program is required to exactly roproduce the format and behavior of the log of execution as follows: Eiter an It 416 bo pou want to weunch agaiel x tirter an at and to tasi not faind De yee want to searth satati? y tires an toi kite 10 is not vitiit an yiu wat se semerh agaknt bent Have a nick int beadersias follows % - A static method to retricve a information of a person based on their iD number, and return the correspondine data line in the file. If the serchedib is hat present, the method will return a message "Not Found" The parameter "searchld" represents the search iD number. - A method to calculate the total hours worked by the persen and putputs their into. Here the line Will be the persan data extracled frorm the hile nsitchink the seresch id Hours answer, corrected public scatic void main (String [l args) I try Scanner input = new Scanner (new File ("hours,txt")); While (input. hasNextline ()) I //while it is not end of flle (1) promess each person String 1 ine = input. nextiine () Scanner Iinescan = new Scanner (iine); feriprocess the contenta of this line int id = linescan. nextint (); String name = 1 inescan. next () ; double totalHours =0; int day =0; while (1ineScan, hasNextDouble()) i totalHours t= Inescan, nextDouble (): day+t; System.out.println (name + " (IDA" +idt") wozked "+totalHours+" hours "totalHours/day+ " houra/day)")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
