0% found this document useful (0 votes)
12 views7 pages

Class Diagram for Flight Booking System

The document discusses class diagrams for three scenarios. The first scenario involves departments, offices, and employees. The second scenario involves Java code with classes Driver and StringContainer. The third scenario involves collectors, collections, and items.

Uploaded by

sheen gay
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views7 pages

Class Diagram for Flight Booking System

The document discusses class diagrams for three scenarios. The first scenario involves departments, offices, and employees. The second scenario involves Java code with classes Driver and StringContainer. The third scenario involves collectors, collections, and items.

Uploaded by

sheen gay
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Object Oriented Development with Java (CT038-3-2) Class Diagram

Lab 5 –Class Diagram


Answer the following questions.

Draw a class diagram which consists of all the classes in your system attributes and
operations, relationships between the classes, multiplicity, and other model elements that you
find appropriate.

1. APComp consists of several departments. The departments are located in one or more
offices. One office acts as a headquarter. Each department has a manager who is
recruited from the set of employees.

2. Consider the following Java code:

import [Link];

public class Driver {


private StringContainer b = null;

public static void main(String[] args){


Driver d = new Driver();
[Link]();
}

public void run() {


b = new StringContainer();
[Link]("One");
[Link]("Two");
[Link]("One");
}
}

class StringContainer {
private Vector v = null;

public void add(String s) {


init();
[Link](s);
}

public boolean remove(String s) {


init();
return [Link](s);
}

private void init() {


if (v == null)
v = new Vector();
}
}

Level 2 Asia Pacific University of Technology and Innovation Page 1 of 2


Object Oriented Development with Java (CT038-3-2) Class Diagram

3. To be a collector you have to have one or more collections. Each collection must have
2 or more items. Each collection belongs to one collector. A collection is made up of
items owned. A particular item may be in more than one collection.

Level 2 Asia Pacific University of Technology and Innovation Page 2 of 2


Object Oriented Development with Java (CT038-3-2) Class Diagram

Consider the following scenario.

You, as an Information Technology manager of AsiaMax Airline Company, are required to


develop a new Flight Ticket Booking System (FTBS). The new computerised system can
support the work of the flight ticket booking activities to the administration clerk and report
generation to the manager. In booking flight tickets, the customers can walk in to the counter
to book the tickets.

The administrative clerk is able to register, update and search customer’s details when the
registration is required for ticket booking. In this registration, customers are required to
provide name, identity or passport number, date of birth, address, contact number and email
address. The system will generate unique customer ID automatically and this customer
information will be stored in database.

Following the registration, customers can proceed to book the tickets by providing the place
to go, the date of departure and return, number of tickets (adult or kids), type of seat (business
or economy), and passenger information. The attended clerk will search the desired tickets
with the flight schedule. In this search process, a list of available flight schedule will be
displayed for customer selection. The selected schedule and customer information will be
placed to the customer booking file. This file contains customer information and booking
details. The customer will then do final confirmation regarding the reservation with the total
payment required inclusive of tax. Once the confirmation is made, customers are required to
make payment of their reservation. A receipt will be generated when the payment is recorded.

The manager is able to read reports of monthly sales, detail customers, peak season ticket
sales. The administrative clerk and manager have the authority access to report generation
feature. The system is required to record the generated report date and time, person who
generates that report and report title.

All the end users are required to login to the system in order to use the functions.

TASK 1

Analyse the above scenario and construct a use case diagram that depicts the functional
requirements for the AsiaMax Airline Company.

TASK 2

Create a class diagram for FTBS of AsiaMax Airline Company. Look for opportunities to use
the generalisation and composition and/or aggregation symbols. The class diagram should
include main attributes and some methods for the major classes only. You may make any
relevant assumptions about the business rules to support your answer.

Level 2 Asia Pacific University of Technology and Innovation Page 3 of 2


Object Oriented Development with Java (CT038-3-2) Class Diagram

Collector Collection
1 1..*

2..*

Item
2..*

Level 2 Asia Pacific University of Technology and Innovation Page 4 of 2


Object Oriented Development with Java (CT038-3-2) Class Diagram

Level 2 Asia Pacific University of Technology and Innovation Page 5 of 2


Object Oriented Development with Java (CT038-3-2) Class Diagram

Level 2 Asia Pacific University of Technology and Innovation Page 6 of 2


Object Oriented Development with Java (CT038-3-2) Class Diagram

Level 2 Asia Pacific University of Technology and Innovation Page 7 of 2

Common questions

Powered by AI

The concept of multiplicity in the class diagram for APComp indicates that a department can be located in one or more offices. Additionally, one office serves as the headquarters, demonstrating a many-to-one relationship between departments and offices. This use of multiplicity helps define the structural constraints within the system .

Aggregation in a class diagram for the FTBS provides the advantage of representing the 'has-a' relationship between objects, such as a booking being composed of several entities like customer details and payment information. This simplifies understanding of complex systems by modularizing components while preserving their relationships .

The class diagram represents the relationship between collections and collectors using a one-to-many association; each collector must have one or more collections, as indicated by the multiplicity 1..* for collectors and 1 for each collection .

In the FTBS, the administrative clerk has the role of registering, updating, and searching customer details. They are also responsible for assisting customers in booking tickets by searching for available flights and managing customer files. Additionally, clerks have authority access to generate reports .

A generated unique customer ID facilitates efficient and accurate identification of customers within the FTBS. It enables faster database retrieval and reduced errors in customer management, ensuring each transaction is linked to the correct individual and enhancing record-keeping and security .

Report generation in FTBS serves as a critical function enabling managers and clerks to monitor and analyze different aspects such as sales, customer details, and peak season activity. The system records generated reports' metadata, helping in auditing and accountability. This capability supports decision-making processes and resource allocation .

Encapsulation in the Java Driver class hides internal details of managing string elements within StringContainer, which uses private data members and methods like add and remove. This design restricts access to object internals, preventing external interference and ensuring controlled data manipulation within the run process, thus supporting data integrity and class cohesiveness .

The class diagram is essential for modeling the FTBS because it provides a static view of the system's structure, illustrating key entities such as customers, tickets, and flights, and their relationships. It aids in identifying class responsibilities and encapsulating data within objects, facilitating better system design and communication among developers .

The StringContainer class in the document uses a Vector to store strings, initializing the vector only when elements are added or removed. Unlike ArrayList, which is not synchronized, Vector ensures thread safety but at a performance cost due to synchronized methods. StringContainer mimics basic add and remove operations akin to those of a classical ArrayList but lacks additional functionalities like automatic resizing or advanced manipulation methods .

In designing the FTBS class diagram, inheritance should be considered for promoting code reuse and reducing redundancy by hierarchically categorizing classes such as User or Ticket. It allows common behaviors and attributes to be defined in a base class while enabling specialization in derived classes, providing flexibility and future system scalability .

You might also like