Using Eclipse and Unit Testing

Homework #1

10 points

Due: Friday, January 23

Using Eclipse for the first time:

  1. start Eclipse from the Applications folder
  2. accept the default workspace location. Eclipse will store all of the code that you write and any other configuration information for your Java projects in this workspace folder.
  3. close the Welcome tab

Creating a new project and class:

  1. use File->New to create a new Java Project. Call your new project SocialSecurityTaxCalculator, then click Finish.
  2. right-click on your new project name (SocialSecurityTaxCalculator) in the Package Explorer tab, and select New->Class.
  3. in the Name: textbox, enter the name of your class as TaxCalculator, and then click Finish. Your new class should now appear in the Eclipse editor.

Implementing the TaxCalculator class:

Note that Eclipse will compile your class each time that you save it. Any compilation errors will be displayed in the Problems tab (at the bottom).

Implement the following methods in the TaxCalculator class, declaring fields as needed. Use the exact method names specified, with the same return types and parameters. Include a brief javadoc comment explaining the purpose of each method. You do not need to use @param and @return tags in your javadoc comments.

When complete, this class will calculate the social security tax paid by a particular tax payer, depending on that person's salary and whether or not they are self employed.

Adding a main method:

Recall that the main method specifies what happens when a Java program is actually run.

Unit Testing in Eclipse with JUnit 4:

Handing in this Assignment

To hand in this assignment, email me (wahlst@dickinson.edu) your TaxCalculator.java and TaxCalculatorTest.java files, which are located in your workspace/SocialSecurityTaxCalculator folder.