CSE 8B:
Introduction to Computer Science: Java
(Winter, 2006)
Home | Syllabus |
Schedule | Exams |
Programming Assignments
Programming Assignment 1
Due January 16 at 11:59 PM.
There are two things you need to do in this assignment: read and agree to the Integrity
of Scholarship, and work with Unit tests (as discussed in Lecture).
Agree to the Integrity of Scholarship
First, read the CSE 8 Integrity of Scholarship page.
Then, create a file called "agreement.txt" that contains the following
(replacing YOUR_NAME, STUDENT_ID and TODAYS_DATE with correct values).
I, YOUR_NAME, have read the CSE 8 Integrity of Scholarship page and will abide by its polices.
YOUR_NAME STUDENT_ID DATE
Become familiar with unit tests
- Copy all the files from the P1 directory in the public directory (~/../public/P1/*).
- Build the java programs by running make. The unit test should succeeed.
- Save the results of the unit test with: java TestTemperature > testpasses.txt
- Add a new test to TestTemperature.java called testExactTemperature that:
- Creates a fahrenheit temperature t, whose value is Math.PI.
- Uses assertEquals to assert that the centigrade temperature of t is exactly equal to -16.0324.
You should be using the overloaded assertEquals that takes three double parameters, with the third
being the tolerance of the floating-point comparison (your tolerance should be 0.0).
- Build with make again. The unit test should fail.
- Save the results of the unit test with: java TestTemperature > testfails.txt
Turnin
Create a directory on ieng6 with the following files:
- agreement.txt
- testpasses.txt
- testfails.txt
- TestTemperature.java
To turn in your assignment, cd to that directory and run the command
bundleP1
and carefully follow the dialog.
If it is before the due deadline and all necessary assignment files are present,
this will turn in your solution files.
You can run bundleP1 more than once if you want; only the last one will count.
Subsequent assignments will be turned in with similar commands, bundleP2, bundleP3 and so on.
Grading
The assignment is worth 20 points:
- 5 points: Correctly completing agreement.txt
- 3 points: Correct testpasses.txt
- 8 points: A testExactTemperature method that does as the assignment requests
- 4 points: Correct testfails.txt
As always, an additional 5% (1 point) is available if you turn the assignment in at least 24 hours early.