During our tips and tricks sessions, you will have the opportunity to code your own solutions to the exercises we solve as a group. Follow these instructions to set up your workspace.
- Open Eclipse, and go to the SVN Repository Exploring perspective.
- Add a new repository with the following URL:
Replace ###### with a number you can get from Shane.
- Right-click on the repository, and choose “Find/Check Out As”
- Use the project wizard. Name the project “ACMTipsAndTricks” or something of that nature. Keep most of the settings the same, except choose “Use project folder as root for source and class files”.
- When that step is complete, create a new package inside your repository. Name it “IOTest”.
- Create a new class in your package. Name it “Main”.
- Paste in the code from this post, filling in the blanks as appropriate.
- Next, create an account with the UVa Online Judge. Leave the last two fields in the registration form blank.
- Take this opportunity to solve The 3n+1 Problem, which is the first ICPC-type problem that many people ever get to solve. If you need help using Scanner, please ask Shane.
- When you are ready to test your solution, create another file in your package called “sample.in”. Copy and paste the sample input from the problem statement into that file. The skeleton is already coded to use this file as your input.
- When you have your solution, paste it into the Quick Submit box in the UVa Online Judge. The problem ID is 100. Choose Java 1.6 as your language. Before you submit your response for grading, you also need to change two more things:
- Remove the package declaration.
- Add an extra star (asterisk) on line 14. This is a comment trick that changes the input source from our sample.in file to the Standard Input that the autograder uses.
Then press “submit” and cross your fingers. To see your results, go to “My Submissions” on the left side of the page. You may need to refresh the page a few times before your solution has finished running.
- At the end of the day, commit your work back up to the repository so that you can always get it back again and so that you can work in the same workspace on multiple computers.