Question: JAVA: In main, I am processing a file input that has a String employeeNumber followed by a series (1 - 3) of int jobNumber on
JAVA: In main, I am processing a file input that has a String employeeNumber followed by a series (1 - 3) of int jobNumber on the same line. Each line needs to be processed and displayed to a report in a different JobPrint class where it will be printed to a report. I need the code that will process the String item and the int items in such a way that it can be printed to a report.
Example input:
smith444 3974 2238 2222 // this has three job numbers
davis222 4567 // this has one job number
john777 2121 3434 // this has two job numbers
Example code:
public static void main(String[] args) {
String employeeNumber; int jobNumber; File inputDataFile = new File(JOB_REPORT); Scanner dataInput = new Scanner(inputDataFile); String [] jobReport = new String [100]; // array of 100 does not mean anything while(dataInput.hasNextLine()){ String aLine = dataInput.nextLine(); jobReport = aLine.split(" "); /* I don't know what to do here! */ } JobPrint jobPrint = new JobPrint(); jobPrint.printToFile( // some arguement);
}
public class JobPrint(){
//empty constructor but does not have to be public JobPrint(){ }
public printToFile( // some parameter){ File outputDataFile = new File(JOB_REPORT_PROCESSED); PrintWriter jobOutput = new PrintWriter(outputDataFile); /* I don't know what goes here. /* }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
