CS 1401 Assignment #11
Date Assigned: Monday, November 10 or Tuesday, November 11, 2008.
|
Due Dates: Both electronic and printed versions
of your work must be submitted according to the following schedule: ·
Electronic version: The electronic version must be emailed to your TA
by 11:59 p.m. Sunday, November 16 (for MWF labs), or by 11:59
p.m. Monday, November 17, 2008 (for TR labs). Attach source code
file(s). ·
Printed version: A printout of your assignment must be handed in to your TA at
the beginning of your lab section the following day, either Monday, November 17 (for MWF labs), or Tuesday, November 18, 2008 (for TR labs). Objective:
The main objective of this assignment is to practice with inheritance. Make
sure you turn in your assignment, both electronic and printed versions, on
time even if unfinished. Partial credit will be given for incomplete
assignments turned in on time. A significant late penalty will apply if
printed versions are not turned in at the beginning of lab. Failure to
submit electronic versions on time will result in NO CREDIT for the
assignment. If your program does
not compile, you will receive NO CREDIT.
If it does not compile, do not delete problem statements; keep all the statements in your program so
that you may receive as many points as possible, but comment out statements
as necessary in order for your program to compile successfully. |
Programming
assignment:
In this lab you will
continue developing the game of MinerQuest. The player will enter commands as usual to
move from office to office in the Computer Science Building, until the player
enters the command to quit. In a
previous lab, you defined a Room class and created individual Room
objects. In addition, you defined arrays
of items present in the rooms and moved items from the rooms to the
office. In this lab, you will be making
the following changes to implement inheritance:
·
Modify
your Room class to be a superclass, and define the
following specific kinds of rooms as subclasses of Room:
o
Professors’
Offices
o
Department
Offices
o
Labs
·
Define
a superclass for a group of items named PC Components. The instance variables for the superclass are size
and manufacturer. Define subclasses for the categories of PC Components
listed below (more may be added if desired).
For each component subclass, include at least one additional instance
variable that is unique to that subclass.
o
Hard
Drive
o
RAM
o
Motherboard
·
Define
a class named Book. Instance variables for books are title and
author (both String).
Create and distribute PC components and at least 3 books in various rooms, as you did with other items. Set the title of one of the books to be How to Build a PC. As the player travels from room to room, PC components and books may be taken and added to an array of the player’s items. If the player succeeds in finding and taking the book How to Build a PC, as well as at least three of the PC components, the player should receive a generous bonus of gold nuggets. (We shall assume that the player has succeeded in building and selling the PC to help earn the Engineering ring.)
Expanded CS Building Map (not drawn to scale):
Dr. Novick’s Office |
Room 243 (HallwaySegment) |
Dr. Ward’s Office |
|
Dr. Mondave’s Office |
|
||
Dr. Fuentes’s Office |
|
||
|
Room 242 (Hallway
Segment) |
Room 209 (Martha’s Office) |
|
|
Room 241 (Foyer) |
Room 0 (Front Entrance) |
||
|
Room 234 (Dept. Office) |
|
|
|
Room 231 (Dept. Chair’s Office) |
|
Deliverables: as instructed by your TA.