CS239 Advanced Programming
|
 |
Software Requirements Specification
Programming Assignment 6 - Parking Cars
Due Thursday, Apr 24 by 10:00pm, cannot be submitted after Friday April 25, 10:00pm
Hardcopy materials due in my office no later than Monday during office hours TBA.
Introduction
Parking is a major problem in many cities. In this
application, you will build an application that will manage a parking
lot.
Purpose: This application will simulate a
parking lot that is bound on three sides by buildings. The lot is
small, 5 lanes at 100 feet each. You must add and remove the cars from
one end of the lot only. Parking the cars involves finding a lane
which has enough room for the car and pulling it behind the other cars
in the lane. Retrieving the car involves moving all the cars
behind it out, then removing the car that is retrieved, then putting
the cars back filling the gap where the removed car had been. See
example in picture.


When a car is added to the lot, it is assigned a vehicle id (VID) (such
as 79). The owner gets a receipt with that number for later
retrieval of his or her vehicle.
When adding a car to the lot, the managers have decided to use a "worst
fit" algorithm while the lot is less than 1/2 full. (The total
length of the cars parked is < 250 feet). When the lot becomes
1/2 full or greater, they switch to a "best fit" algorithm. Worst
fit specifies that given a set of spaces, you will put the object (in
this case a car) into the space that is the biggest that will
accomodate the object(leaving the largest block of unused space). Best fit specifies that given a set of
spaces, you will put the object (in this case a car) into the space
that is the smallest that will accommodate the object (leaving the smallest amount of unused space).
If a car comes to be parked, but there is not enough room to park it, you must turn it away.
The application should keep track of:
- Where each car is, given its VID or its license number.
Location is specified by row and position within the row starting
from the building side (as 1).
- How many cars are in the lot at any given time
- How many cars we have parked each session including all those that have left.
- How many cars were turned away because there was not enough room.
- The total length of cars in the lot
- How many cars (other than the retrieved car) were move to retrieve cars during that session.
Deadlines
- Finished submit, Thursday April 24. May NOT be submitted
after Friday April 25. Submit will do no testing...that is your
job...and will be available as early as April 13.
- Report: Must be turned in no later than my office hours on
Monday of exam week. Special exam week hours will be posted. A 10
points/day late penalty will apply for each of the 2 deadlines. If the
submit is late, the report is due the next class or lab session day
after successful submission. No programs will be accepted if they are
submitted after April 25 (Friday).
- The report will include:
- The normal pdf report.
- The team reporting sheet.
- A completed design document that reflects ALL of the instance variables and methods. This must be in UML format.
- Completed Java docs posted to a PA6 folder on one member of the team's directory.
- Your test plan implemented as a series of files that can be
used to test the application. These should be zipped and loaded
to the pertinent Blackboard assignment page.
- In addition, each team member will submit a team member evaluation report individually. These may be kept in confidence.
Teamwork
This assignment is to be done with your team. You may collaborate
on any aspect of the assignment and frequent collaboration is
encouraged. However, each team member will take responsibility
for one aspect of this assignment. The team reporting sheet will
tell me who has responsibility for which part. The "ownership"
pieces are:
- Design - The team member with responsibility for design will be
responsible for creating the final UML diagram. Unlike previous
assignments, this should be complete and should show ALL classes,
methods and instance variables used along with the relationships among
the classes.
- Test plan - The team member with responsibility for the test plan
will be responsible for submitting the test plan to the Blackboard
assignment. The test plan will include a series of files like are
used in submit to simulate the manual entry of data from the keyboard.
In addition, a text document should be created that will give me
the name of the file and what behavior(s) you are testing with that
particular file. I should be able to run tests by typing java ProgramFilename < testFileName at the command line.
- Javadocs - The team member with responsibility for the Javadocs
should review the final version of the program and insure that all of
the conventioins for javadocs have been followed. If a method
may throw an exception, the appropriate tag should be used as
well as the normal ones we have been using. The javadocs should
match the version of the program that is submitted to the test system
and the Javadocs should be placed on that student's www directory on
stu in a folder labelled pa6. Be sure to double check that you
can reach them.
For teams with 4 or 5 people:
- Each additional person should take charge of the biggest program
files. This might be the file containing the linked list code or
the IO file, depending on how you have built the program. These
people should be the "author" of the file, but the acknowledgement
should include the other team members that assisted on writing that
segment.
In all cases, you should acknowledge in all files who worked on that
particular file either through the author tag or the acknowledgements
section.
Input
A menu will control the action. See the output section for what
the menu will look like. Users will enter a number to identify an
action to take, Park a car, Retrieve a car, Show lot, or Exit.
Park a car: When the user chooses to park a car, the user will enter:
- License number of the car.
- The length of the car
- Its description
Retrieve a car: When the user chooses to retrieve a car, the user will enter:
- License number of the car OR
- The VID number.
Show lot: There is no input to Show lot
Exit: When the user chooses to exit, the user must confirm by typing Yes, yes, Y or y.
Output
Menu
1. Output a welcome message, "Welcome to the Parking Lot Manager". This should be followed by a blank line.
2. Output the menu.
Choose an option from this menu:
1. Park a car
2. Retrieve a car
3. Show lot
4. Exit
Each menu option should be indented one tab space.
The Choose ... line should be flush with the left hand margin.
3. On the line immediately following the menu, output "-->" and this
should be flush with the left hand margin. The cursor should
remain to the right of the arrow.
4. Output a blank line immediately following entry of a value and before printing any other output.
Park a car
- Output the prompt: "License number: " . The cursor should remain on the line beside the prompt awaiting entry.
- On a new line output the prompt: "Length: ". The cursor should remain on the line beside the prompt awaiting entry.
- On a new line output the prompt: "Description: ". The cursor should remain on the line beside the prompt awaiting entry.
- Output a blank line.
- If there is room for the car, output the vehicle id, the lane
number, and the position as follows: "VID-" followed by the assigned
number followed by a tab followed by "Lane: " followed by the lane
number (1 based) followed by "-" followed by the position (1 based).
Note: Cars are always parked at the end of the available lane.
- If there is not room for the car in the lot, see the error message section.
Retrieve a car
- Output the prompt, "VID: ". The cursor should remain on the line beside the prompt awaiting entry.
- If the user simply hits the enter key, output the prompt,
"License number: ". The cursor should remain on the line beside
the prompt awaiting entry.
- Output a blank line before printing any error messages or the location information.
- Output the location information as follows: "VID-" followed by
the assigned number followed by the vehicle description followed by
a tab followed by "Lane: " followed by the lane number (1 based)
followed by "-" followed by the position (1 based). On the next
line, output the number of vehicles to move before reaching the
designated vehicle, "Move x vehicles", where x is the number of
vehicles to move.
Show lot
Display each lane in order (1 - 5) in the following fashion.
- On the first line "Lane: " followed by the lane number followed by " " followed by the number of vehicles in the lane.
- On the subsequent lines, one line per vehicle, a description of
the vehicle: ""VID-" followed by the assigned number followed by the
vehicle
description followed by a tab followed by "Lane: " followed by the
lane
number (1 based) followed by "-" followed by the position (1 based).
- After all five lanes have been displayed, output a blank line.
- Output summary information as follows, each on its own line and each indented by one tab space:
- "Current number of vehicles: " followed by the number of vehicles currently in the lot.
- "Number today: " followed by the total number of vehicles that were parked in the lot this day
- "Turn downs: "followed by the number of vehicles that came but could not be parked.
- Output a blank line.
Exit
Display the message: "Are you sure you want to exit and reset the lot? ". The cursor should remain beside the prompt.
Errors
Choosing a menu option:
- If a user enters anything other than one of the 4 valid options,
display a message: "Your choice " followed by their entry followed by "
is invalid. Try again." You should redisplay the "-->"
prompt but NOT redisplay the entire menu.
Park a car:
- We will accept any input for License number in the Park a car function.
- If a user enters a length that is not numeric or is negative or
0, display a message: "The length " followed by the length " is
invalid. Try again." The original prompt should redisplay.
- If there is not enough room for the car, a message should display
"There is no room for this vehicle." The menu should redisplay.
Retrieve a car:
- When retrieving a car, if the car matching that license number or
VID does not
exist, an error message should print: "This license: " followed by the
license number followed by " is not in the lot." or "This VID: "
followed by the VID number followed by " is not in the lot."
After displaying
this message return to the menu.
- If when prompted for the VID a user enters something other than a
positive number, display the message "The value you entered " followed
by the entry followed by " is not a valid ID. Try again.".
Then the original prompt should redisplay on the next line.
- If when prompted for the license number, a user just presses the enter key, you should reprompt for the VID.
Exit: If the user enters anything other than Yes, yes, Y, or y, redisplay the original menu.
Description of Classes
Thinking about this problem, you have several "nouns" that represent
objects in the problem. Cars, the lot, the lanes are all
important features within this program and each has its own job to do.
In addition, you may choose to add additional helper classes.
One recommended class is your IO class. None of the other
classes should do IO directly.
The lanes have one additional requirement. You MUST implement
your lanes using a type-safe linked list of Car objects.
Additional Program Requirements
- Your program must include an acknowledgement section acknowledging help
received from TAs or reference sources. You do not need to reference
receiving help from the instructor.
- If you received no help your acknowledgement section should have a
statement to that effect.
- Your program must conform to standard Java programming standards and
the additional requirements for this class. See the Style Guide for this
class.
Test Plan
The test plan is an important part of this assignment. You
should consider all possibilities for how a user might enter data and
usual and unusual values for the vehicles entering and leaving the lot.
Honor Code
This work must conform to the JMU Honor Code and the specific
requirements
of this class. Help may be obtained from other students, but any code
that you write must be your own or your group members work. The
names of all contributors to a particular program must be listed in the
references or author section.
Grading
Grading is a little more complex for this assignment. There will
be individual grades and group grades and together they will form your
overall grade.
- 10% of the grade will be based on the group evaluation. You
must evaluate the contribution of each team member and turn that in.
The group evaluation sheets may be turned in separately from the
rest of the assignment. Failure to turn in a group evaluation
sheet will cause you to lose the 10%.
- 20% of the grade will be based on your unique contribution to the group.
- 70% of the grade will be based on the group project.