| Project #2 | CMSC 132 |
| Due Dates: Design: Thursday Sept 22, 6:00 pm Implementation: Wednesday Sept 28, 6:00 pm |
Object-Oriented Programming II |
| Type of Homework: Closed | Fall 2005 |
Objective
This homework will give you practice designing object-oriented software solutions using UML. In case you have not already noticed, this is Closed homework. You must read the Open/Closed policy before working on this project. The policy can be found at policy.
Overview
For this project you will develop and implement a design for a cruise line database. The database keeps track of passengers, room attendants, ship information etc. (more details are available below). The first part of your project consists of submitting an UML class diagram representing the cruise line database system. The second part consists of implementing your design. Each part has a separate deadline.
Your project will graded as follows:
Design (UML class diagram ) - 35%
Implementation of design - 30%
Tests - 30% (public and release tests)
Style - 5%
Keep in mind that your implementation must match your design, otherwise you will lose most of the implementation points.
We encourage you to start working on this project as soon as possible, as there are a lot of details that can not be completely specified in this description. The earlier you start the sooner you will get the feedback you need to complete this assignment.
IMPORTANT: Unlike project#1 the number of release tokens for this project is 2.
UML Class Diagram
Submit a UML class diagram by creating a word document named uml.doc. The deadline to submit this document is Thursday Sept 22, 6:00 pm. Submit your design using the submit server (not the project submit button) by selecting the entry P2-UML Design. Keep in mind that there is no late period to submit your design. You must submit by Sept 22 otherwise you will receive no credit for your design.
Make sure you include the Cruise class as part of your diagram. Also, read the Cruise class javadoc documentation as this will provide additional information on what is expected from the database system.
Implementation
For this project you will implement a cruise line database system. In this system we keep track of passengers, and personnel responsible for the operation of a cruise. The cruise personnel is organized in three main groups: officers, room attendants, and engineers. The cruise ship information maintained by the database is the name of the ship, and the number, type, and cost for each ship's room. The database also keeps track of the ports of calls (schedule stops), and some miscellaneous information like dinner time. Keep in mind that we are simplifying the actual information that is required to represent a real cruise database system.
For this project you get to decide what classes and/or interfaces you want to define and use. However, there is one class that you must implement according to a set of provided specifications. This class is the Cruise class whose documentation you can find at Cruise class javadoc documentation. This is the class through which we will test your implementation. We have provided a driver in this description (and in the code distribution) that illustrates how to use the Cruise class to access the database system.
The project's code distribution is available by checking out the project named p2. The code distribution provides you with the following:
Requirements
Honor Section Requirements
There is no additional requirements for the honor section.
Submission
Submit your project using the submit project option associated with Eclipse. Do not wait until the day before the project is due to check whether you can submit your project.
Academic Integrity
Please make sure you read the academic integrity section of the syllabus so you understand what is permissible in our programming projects. We want to remind you that we check your project against other students' projects and any case of academic dishonesty will be referred to the University's Office of Judicial Programs.
Sample Driver
Driver.java
package cruise;
/** * Driver - Class that provides an example of how we can use the Cruise class. * * @author cmsc132 Fall 2005 * Copyright (C) 2005 University of Maryland * */
public class Driver {
public static void main(String[] args) {
String shipName = "Majesty";
int windowRooms = 2, interiorRooms = 4;
double windowRoomCost = 150.00, interiorRoomCost = 200.00;
String[] portsOfCalls = {"Miami", "Bahamas", "Key West", "Miami"};
String dinnerTime = "7:00pm";
System.out.println("======================================================================");
Cruise cruise = new Cruise(shipName, windowRooms, interiorRooms,windowRoomCost, interiorRoomCost,
portsOfCalls, dinnerTime);
System.out.println(cruise.getShipInfo());
System.out.println("======================================================================");
cruise.addOfficer("Smith,Rose", "45th Street NW Washington FL", 40, 'F', "Captain", "ClassA", 10, 75000);
cruise.addOfficer("Robinson,Jack", "5th Ave Long Beach CA", 35, 'M', "First Officer", "ClassB", 7, 45000);
System.out.println(cruise.getPeople('O'));
System.out.println("======================================================================");
String officerInfo = cruise.find("Robinson,Jack");
if (officerInfo != null)
System.out.println(officerInfo);
else
System.out.println("Officer not found");
System.out.println("======================================================================");
cruise.remove("Robinson,Jack");
System.out.println(cruise.getPeople('O'));
System.out.println("======================================================================");
cruise.addEngineer("Porter,Carlos", "6000 St Greenbelt NC", 35, 'M', 4, "12:30pm", "8:30pm", 3, 35000, "Electrical");
cruise.addEngineer("Borland,Kathy", "7000 St Bethesda MD", 25, 'F', 2, "8:30am", "4:30pm", 2, 30000, "Mechanical");
cruise.addRoomAttendant("Lucas,Tom", "3rd Ave Wisconsin CA", 21, 'M', 3, "8:30am", "4:30pm", 1, 25000, new int[]{2,3}, 2);
System.out.println(cruise.getPeople('E'));
System.out.println(cruise.getPeople('R'));
System.out.println("======================================================================");
cruise.addPassenger("Perez,Rachel", "6000 St Bethesda MD", 45, 'F', 'I');
cruise.addPassenger("Ford,Tim", "8000 St Silver Spring MD", 25, 'M', 'W');
System.out.println(cruise.getPeople('P'));
System.out.println("======================================================================");
cruise.addToPassengerBill("Perez,Rachel", 175);
System.out.println(cruise.getPeople('P'));
}
}
Output
====================================================================== Ship's Name: Majesty Room(s): Room Info: Number: 1, Type: W, Occupied: false, Cost: $150.00 Room Info: Number: 2, Type: W, Occupied: false, Cost: $150.00 Room Info: Number: 3, Type: I, Occupied: false, Cost: $200.00 Room Info: Number: 4, Type: I, Occupied: false, Cost: $200.00 Room Info: Number: 5, Type: I, Occupied: false, Cost: $200.00 Room Info: Number: 6, Type: I, Occupied: false, Cost: $200.00 Ports of Call: Miami Bahamas Key West Miami Dinner Time: 7:00pm ====================================================================== Name: Robinson,Jack Address: 5th Ave Long Beach CA Age: 35, Sex: M Rank: First Officer, ShipRestriction: ClassB, YearsOfService: 7, Salary: $45,000.00 ==================================================== Name: Smith,Rose Address: 45th Street NW Washington FL Age: 40, Sex: F Rank: Captain, ShipRestriction: ClassA, YearsOfService: 10, Salary: $75,000.00 ====================================================================== Name: Robinson,Jack Address: 5th Ave Long Beach CA Age: 35, Sex: M Rank: First Officer, ShipRestriction: ClassB, YearsOfService: 7, Salary: $45,000.00 ====================================================================== Name: Smith,Rose Address: 45th Street NW Washington FL Age: 40, Sex: F Rank: Captain, ShipRestriction: ClassA, YearsOfService: 10, Salary: $75,000.00 ====================================================================== Name: Borland,Kathy Address: 7000 St Bethesda MD Age: 25, Sex: F, YearsOfService: 2, Salary: $30,000.00 Assigned Deck: 2, Shift: StartTime: 8:30am, EndTime: 4:30pm Specialty: Mechanical ==================================================== Name: Porter,Carlos Address: 6000 St Greenbelt NC Age: 35, Sex: M, YearsOfService: 3, Salary: $35,000.00 Assigned Deck: 4, Shift: StartTime: 12:30pm, EndTime: 8:30pm Specialty: Electrical Name: Lucas,Tom Address: 3rd Ave Wisconsin CA Age: 21, Sex: M, YearsOfService: 1, Salary: $25,000.00 Assigned Deck: 3, Shift: StartTime: 8:30am, EndTime: 4:30pm Daily Rounds: 2 Room(s): Room Info: Number: 2, Type: W, Occupied: false, Cost: $150.00 Room Info: Number: 3, Type: I, Occupied: false, Cost: $200.00 ====================================================================== Name: Ford,Tim Address: 8000 St Silver Spring MD Age: 25, Sex: M Room Info: Number: 1, Type: W, Occupied: true, Cost: $150.00 Bill: $150.00 ==================================================== Name: Perez,Rachel Address: 6000 St Bethesda MD Age: 45, Sex: F Room Info: Number: 3, Type: I, Occupied: true, Cost: $200.00 Bill: $200.00 ====================================================================== Name: Ford,Tim Address: 8000 St Silver Spring MD Age: 25, Sex: M Room Info: Number: 1, Type: W, Occupied: true, Cost: $150.00 Bill: $150.00 ==================================================== Name: Perez,Rachel Address: 6000 St Bethesda MD Age: 45, Sex: F Room Info: Number: 3, Type: I, Occupied: true, Cost: $200.00 Bill: $375.00