Created
February 23, 2019 21:10
-
-
Save otaruMendez/9b183579f24250a8c9b0418cbd6c1676 to your computer and use it in GitHub Desktop.
Printing the Output in the Simulator Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void printOutput () { | |
PrintWriter writer = null; | |
try { | |
writer = new PrintWriter(this.fileName + ".out", "UTF-8"); | |
int noOfSlices = pizzaCutter.cutSlices.size(); | |
writer.print(noOfSlices); | |
writer.println(); | |
for (int j = 0; j < noOfSlices; j++) { | |
Slice cutSlice = pizzaCutter.cutSlices.get(j); | |
writer.print(cutSlice.startX + " " + cutSlice.startY + " " + cutSlice.endX + " " + cutSlice.endY); | |
writer.println(); | |
} | |
writer.close(); | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment