INTRODUCTION TO COMPUTER SCIENCESPRING 2023
hgl235@nyu.edu
HW 4: Stormtrooper Data
Professor Gene Locklear
General
• Stormtrooper files are sent via burst transmissions and therefore must be very concise. However, the conciseness of the
file makes them difficult to read and prevents some information from being transmitted.
• We have been tasked by Imperial Headquarters to provide a Java program that will process these files and make them
easier to read for HQ personnel.
• Example file has been provided.
• Our Java program must process a data file and create a console output that is more readable as shown below.
Data File
Console Output
Task
• Create the static method reWriteTrooperData that accepts no parameters, reads the data located in the Data file, and
prints to the console the corresponding data in the format shown on Slide 2 for each line in the Data file.
• The Rendezvous Point for all Stormtroopers is at X:10 Y:10 Z:10
• The ‘Distance to Rendezvous’ is the 3D Euclidean distance from the Stormtrooper to the Rendezvous Point.
• You may only use the BufferedReader and BufferedWriter classes to read and write files.
• You may only use arrays for any data structure needs your program has.
• You may, if you desire, programmatically manipulate the data in the Data file, in any intermediate way, and create one or
more temporary files to assist you in displaying the correct output. I do this with my RData file, but this is not required.
Program Structure
Create your main method exactly as shown
Contains only helper methods
Contains only reWriteTrooperData method
Contains only main method as shown