Skip to content

Instantly share code, notes, and snippets.

@otaruMendez
Created February 23, 2019 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otaruMendez/9b183579f24250a8c9b0418cbd6c1676 to your computer and use it in GitHub Desktop.
Save otaruMendez/9b183579f24250a8c9b0418cbd6c1676 to your computer and use it in GitHub Desktop.
Printing the Output in the Simulator Class
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