In my program I print the results and output them to a file. The format of the output is different. Can someone tell me why and how I can
make the output to file the same format as the print output.
here is the code:
PrintWriter outFile = new PrintWriter("C:\\users\\remo\\downloads\\Ch3_Ex7Output.txt"); outPut = e1FirstName + " " + e1LastName + " " + String.format("%.2f", employee1Final) + "\n" + e2FirstName + " " + e2LastName + " " + String.format("%.2f", employee2Final) + "\n" + e3FirstName + " " + e3LastName + " " + String.format("%.2f", employee3Final) + "\n"; System.out.printf(outPut); outFile.printf(outPut); inFile.close(); outFile.close();
Here is the print output:
Andrew Miller 3289.49 Sheila Green 4553.55 Amit Sethi 4568.93
here is the file output:
Andrew Miller 3289.49Sheila Green 4553.55Amit Sethi 4568.93
Thanks!