CSE 8B: Introduction to Computer Science: Java (Winter, 2006)

Home | Syllabus | Schedule | Exams | Programming Assignments

Programming Assignment 3

Due Monday, January 30 at 11:59 PM.

Part 1

Part 1 of this assignment is simple: Go to this webpage and answer the question given there on line. It asks you to write an answer in English, not in code. Please read the question carefully. Since you will get credit for doing this part of the assignment, we ask that you do this carefully. But we will not grade you on your answer -- so you don't need to look anything up, just answer based on what you already know.

Part 2

In this assignment, you'll be practicing what you've learned about inheritance from Chapter 7. It is based on Programming project 6 from page 473, with the change that you need to use the method signatures we're providing for the Vehicle and Truck classes.

Test-Driven Development

In this exercise, you are to use test-driven development in the manner described in class. You'll write a test, verify the test fails, then write enough code to get the test to pass. At any point where you've got all tests passing, you can refactor to clean up your implementation code or your test code.

The example from class is available as a QuickTime movie.

The documentation for junit is also available.

Requirements

You are to create three classes: Vehicle, Truck, and Person as described in programming project 6 on page 473 of your book. You are also to create test cases for each of the classes. See the documentation for the requirements for each of the classes. The method signatures should exactly match those in the documentation. The documentation also includes a full description of what each method should do.

Provided files

There are no provided files (although you may find it useful to use the makefile (~/../public/makefile).

Turnin

Create a directory on ieng6 with the following files: To turn in your assignment, cd to that directory and run the command
  bundleP3
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 bundleP3 more than once if you want; only the last one will count.

Grading

The assignment is worth 20 points: As always, an additional 5% (1 point) is available if you turn the assignment in at least 24 hours early.