This Java program defines a Flight class with methods to book tickets, return tickets, and check for valid ticket IDs. The Flight class tracks the number of seats and valid ticket IDs. The main method creates a flight with 5 seats and 5 ticket IDs, books 3 tickets, tries returning an invalid ticket which throws an error, then books the remaining 2 tickets to test the seat counting.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
30 views2 pages
Advanced Programming: Lab 7 Hands On
This Java program defines a Flight class with methods to book tickets, return tickets, and check for valid ticket IDs. The Flight class tracks the number of seats and valid ticket IDs. The main method creates a flight with 5 seats and 5 ticket IDs, books 3 tickets, tries returning an invalid ticket which throws an error, then books the remaining 2 tickets to test the seat counting.