CSC2000 Comprehensive Lab
CSC2000 Comprehensive Lab
2024
Form groups of 10 people. Each group will submit one solution by email to my email. Also,
attach a list of the group members.
EXERCISE
Create a Java application that simulates a basic airline reservation system, allowing users to
search for flights and make reservations.
Requirements:
• Loops: Use loops for iterative tasks like searching for flights and processing
reservations.
• Conditional statements: Use conditional statements to make decisions based on user
input and flight availability.
• Arrays: Store flight information, seat availability, and reservation details in arrays.
• Database (MySQL): Use MySQL to store flight data, reservation information, and
user details.
Steps:
1. Create a database:
o Set up a MySQL database and create tables for flights, reservations, and users.
2. Define Java classes:
o Flight: Represents a flight with attributes like flight number, origin,
destination, departure time, arrival time, and available seats.
o Reservation: Represents a reservation with attributes like reservation ID,
flight, passenger name, and seat number.
o User: Represents a user with attributes like user ID, name, and contact
information.
3. Implement methods:
o Create methods for searching flights, reserving seats, and viewing
reservations.
Skeleton Code:
import java.sql.*;
import java.util.*;
switch (choice) {
case 1:
// Search for flights
break;
case 2:
// Make a reservation
break;
case 3:
// View reservation details
break;
case 4:
System.out.println("Exiting...");
System.exit(0);
default:
System.out.println("Invalid choice.");
}
}
}
Additional Considerations: