0% found this document useful (0 votes)
95 views5 pages

Class Diagram for AsiaMax FTBS

The document describes a class diagram for a flight ticket booking system (FTBS) for AsiaMax Airline Company. [1] The class diagram includes classes for Clerk, Customer, Ticket, Booking, Flight, Schedule, Receipt, and various report classes. [2] The Clerk can register, update, search for customers, search for flights, process payments, and view reports. [3] The Manager can only view reports on monthly sales, customers, and peak ticket sales.

Uploaded by

flowerpot321
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)
95 views5 pages

Class Diagram for AsiaMax FTBS

The document describes a class diagram for a flight ticket booking system (FTBS) for AsiaMax Airline Company. [1] The class diagram includes classes for Clerk, Customer, Ticket, Booking, Flight, Schedule, Receipt, and various report classes. [2] The Clerk can register, update, search for customers, search for flights, process payments, and view reports. [3] The Manager can only view reports on monthly sales, customers, and peak ticket sales.

Uploaded by

flowerpot321
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 headquater. 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

Flight Ticket Booking System (FTBS)

Role (Actor) Task (Bubble) Task (Bubble - Data (Object)


include/extend)
Clerk Register Customer Ticket Booking [Link]/Passport
(include)
Update Customer [Link]
Search Customer [Link]
[Link]
Search Flight [Link]
Receipt Payment [Link]
[Link] ([Link])
View Report
[Link]
Login [Link]
[Link]
[Link]
[Link] (B/E)
[Link] (A/K)
[Link][]

Passenger.
Passenger.
Passenger.

Flight.
Flight.
Flight.
Flight.

Schedule.
Schedule.
Schedule.
Schedule.

Receipt.
Receipt.
Receipt.
Receipt.

Manager View Report [Link]/Time


[Link]

[Link]/Time
[Link]

[Link]/Time

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


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

[Link]

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

Common questions

Powered by AI

To construct a class diagram for a Flight Ticket Booking System (FTBS), the key components include classes such as Customer, Flight, Booking, Receipt, and User (for clerk and manager roles). Attributes for these classes might include customer details (name, ID, passport), flight details (date, time, destination), and booking details (ticket types, seat class). Methods could involve registration, update, search operations, and actions such as payment processing. Relationships among these classes need to be defined, such as aggregation between Customer and Booking, and composition between Flight and Schedule. Use of generalization can be applied for different types of users like clerks and managers. Multiplicity should also be considered to show relationships like one-to-many between customers and bookings .

The concept of composition enhances the design of a collection management system by enabling a strong relationship where the contained objects (items) are integral parts of the container object (collection). In the context of the document, a collection is composed of multiple items. This implies that items exist only as long as the collection exists; when the collection is destroyed, so are the items. This reinforces encapsulation and integrity of the data model by ensuring that the collection truly owns its items and simplifies lifecycle management of objects within the system, ensuring consistency and reducing errors .

Multiplicity in class diagrams specifies how many instances of one class can be associated with a single instance of another class. In the context of the AsiaMax Airline's booking system, multiplicity would define relationships such as each Customer potentially having multiple Bookings (one-to-many), while each Booking is associated with exactly one Flight (many-to-one). It also defines that each Flight can accommodate many Bookings (one-to-many). This impacts the model by enforcing constraints and defining navigation between objects, ensuring accurate representation of real-world scenarios like multiple tickets being purchased per customer or managing capacities for flights .

In a use case diagram for the AsiaMax Airline system, generating a report file would be depicted as a 'Generate Report' use case, involving actors such as the Manager and possibly the Administrative Clerk. The use case would include interaction with the system to select report parameters, and a subsequent relationship to the 'View Report' use case. This generates an output report file, which involves accessing customer and booking data. The diagram might also illustrate an extension point for specifying types of reports, like monthly sales or peak season ticket sales .

To develop a robust class diagram for a flight booking system, one could assume that all customers are uniquely identified by a generated customer ID, which simplifies customer discrimination and system tracking. It could also be assumed that flights have unique identifiers like flight numbers, and booking transactions generate a unique booking ID to track transactions independently. Another assumption might include each administrative action being logged with user details and timestamps to maintain security and accountability. These assumptions ensure clarity in relationships and methods among classes such as Customer, Flight, and Booking .

Failing to initialize the Vector collection in the StringContainer class would result in a NullPointerException when attempting to perform operations on the collection. The StringContainer class prevents this error by using a private helper method 'init()', which checks if the Vector instance is null and initializes it if necessary, ensuring the Vector is always ready for use when methods are called. This proactive error checking through lazy initialization guarantees that operations like add and remove will not encounter a null reference, thus enhancing robustness and reliability of the application .

The inclusion of a manager who is recruited from the employees affects the class diagram by introducing a hierarchical relationship between classes. Specifically, it suggests an inheritance relationship where Manager is a subclass of Employee, inheriting attributes and methods from Employee while also defining additional, manager-specific attributes and operations. This setup supports object-oriented principles such as encapsulation and polymorphism, allowing for reuse and extension of the Employee class functionalities within the Manager class .

The class StringContainer utilizes Java's util package by using the Vector class to manage a collection of strings. The design pattern exemplified by StringContainer is the Singleton pattern, as suggested by the single instance of the collection being lazily initialized in the 'init' method. The private Vector instance is only created if it is null, ensuring that only one instance of Vector exists within the StringContainer at any time. This pattern promotes efficient resource use and controlled access to the collection .

Method overriding plays a critical role in supporting polymorphism within a Java application like the one managing collections in the StringContainer class. By allowing subclasses to provide specific implementations of methods defined in a parent class, overriding permits differentiated behavior based on the object's runtime type rather than the compile-time type. In the StringContainer, while there isn't explicit overriding shown, this principle can be utilized if the class hierarchy is extended. For example, if StringContainer subclasses exist that modify add or remove behavior, overriding allows collections management to dynamically respond to specific data types or conditions per subclass .

Using Vector in the StringContainer class provides several advantages within the Java Collections Framework, including thread-safety and dynamic resizing. Vector is synchronized by default, which ensures that operations are thread-safe without additional synchronization when accessed by multiple threads concurrently. This can be beneficial in multi-threaded environments where consistent data access is required. Additionally, Vector automatically resizes itself as elements are added, simplifying memory management compared to manually managing an array's capacity. However, it is more often used in legacy code since newer implementations like ArrayList offer better performance for single-threaded applications .

You might also like