CS 1401, Quiz 12

Date: Monday, April 14, 2008
Name (please type legibly, ideally in block letters): ______________________________________________________________________
1. Mark what new material is covered and what is not covered in Chapter 12:

2-4. On April 14, 1981, the first flight of a Space Shuttle named "Columbia" ended in a successful landing. While previously designed spaceships could fly only once, a Space Shuttle can fly several times.

2. Define a class SpaceShip in which each object has a name. Do not forget to include a constructor method, accessor methods, and mutator methods.

3. Considering SpaceShip as a superclass, define a subclass SpaceShuttle in which there is also an additional field: the number of flights. Add: accessor and mutator methods for this new field, two constructors -- with a given number of flights and a default constructor with 0 flights, and a method oneMoreFlight which adds 1 to the number of flights.

4. In the main method, define a new object columbia of type SpaceShuttle with name "Columbia" and 0 flights, and then use the method oneMoreFlight to take into account that this Space Shuttle had a successful flight. Trace your code step-by-step.