You are given a file containing coordinates for a 2D or 3D object. You have software that can construct the object based on this file format, assuming that the coordinates start at index 0. However, the file was created assuming indices start at 1. Thus, the goal of this lab is simple: you need to adapt this file so that indices start at 0. In other words, you need to “shift” each coordinate so that it is 1 less than the original and write it to an output file. For example:
Sample line of input file: 1,15 -> Corresponding line in output file should be: 0,14
Much of the code has been written for you. Your task is to fill in the given function stubs so that the program performs the required file conversion. You should test to make sure each function is working properly before moving onto the next. For the convertCoords function, you will likely find it beneficial to review the handout on Strings we discussed a few weeks ago.
To start, make sure that the code compiles correctly. Note that actually running your program at this point would result in a division-by-zero break in execution. Now, implement the missing code in countLines and run your program. Although nothing is actually converted at this point, you should see mock status updates displayed on the console. Notice that convertCoords and writeOutput are overloaded (for 2D, or x,y coordinates, and for 3D, or x,y,z coordinates). Continue by finishing the implementation of the 2D versions of these functions only. Once you get the program to properly convert inCoords_100.txt, run the program on inCoords_1000000.txt. Show me the program execution. Then run the program again, but changing the increment interval of updateStatus to 5% when calling from main.
Finally, update the program by completing the implementation of the 3D (i.e. x, y, and z) versions of convertCoords and writeOutput. Modify the function calls in main so that these candidates of the function are called. Test execution on inCoords_100_3D.txt before trying on inCoords_1000000_3D.txt. Again, show me the program execution.