For this homework assignment, you will create a solution for Project Euler Problem #6. This problem states:
The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 – 385 = 2640. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
See below for more details.
The following files are required for this project. Please download them and add them to your Java project in Eclipse to get started.
See the Setup section below for how to setup your Java project properly.
You are expected to use Eclipse and SVN for all your homework. Below are some example setups for setting up your environment correctly.
If you are on a personal computer or laptop, make sure you have installed the latest version of Eclipse and Subclipse version 1.6.x. If you are on a lab computer, you may skip this step.
Open the "SVN Repository Exploring" perspective. You can select "Open Perspective" from the "Window" menu on most versions of Eclipse.
Add your SVN repository (the button icon has the text "SVN" and a + plus sign). Your repository is located at
username is your USF CS username. Use your US CS Account password when prompted.
If you do not have a
cs212 folder in your repository, please create it now. (Right-click your repository path to get the "New remote folder" option.) Within the
cs212 folder, create an empty folder named
homework01 folder and select "Checkout" from the menu. Click the "Finish" button when the dialog window pops up. Select "Java Project" and click the "Next" button. Finally, enter
Project Euler as the project name, and click the "Finish" button.
Drag the required files for this project (see above) into the
src folder to add them to your project.
You will notice that there are errors in the test file. Open the test file, and mouse-over the
@Test annotation. You will be prompted to add the JUnit 4 package to the build path. Select this option and save.
Run the test code. Your tests should fail initially, but this makes sure your project is properly setup.
Any tutor in the CS Tutoring Center will be able to help you with Eclipse and SVN. There are also more detailed steps located at:
You should complete the setup for this homework in-class! Do not leave until you have verified with the instructor or the teacher assistant that your Eclipse/SVN setup is correct.
Fill in any method with the
// TODO comment. You may change anything within those methods, but not the method name or parameters. Please remove the
// TODO comments once you are finished filling in the missing code.
You may also add additional members and methods to the code. However, do not modify methods provided for you.
You must both pass all of the provided unit tests and pass code inspection by the teacher assistant to receive full credit on this homework assignment. You may not make any modification to the test code.
Submit your work to SVN at
username is your USF Connect username. If you submit correctly using Eclipse, your files will be located at:
The deadline for this assignment is Friday, January 31, 2014 at 11:59pm. If your code is not submitted properly by the deadline, we reserve the right to assign you a 0 for that assignment.