For Java
Project: Train Booking System This project will implement a simple passenger/ticket lookup system using Hash Tables in Java. You should create the Hash Table Class from scratch. You will create three classes: Passenger.java, Bookingsystem.java and Test.java. For the Passenger class you will have the instant variables: String passenger_Name, String ticket_ID and double ticket_price. You will also create a constructor, getters for instant variables, setters for instant variables and toString that prints the passenger_Name, ticket_ID and ticket_price. For the Bookingsystem class, you can store a String passenger_Name, String ticket_ID, and double ticket_price. The passenger_Name will be the key and the ticket_ID and ticket_price will be the value stored. Use quadric probing for collision resolving. The hash function to be used is the following: Key = (sum + p) % size Variable Description Key The index used to store ticket_ID in the hashtable Sum Sum of all characters in the passenger_Name A constant prime value of 19 Size Size of the hash table For the Test class, you will be provided with a text file containing passenger_Name (first and last names) ticket_ID and ticket_price separated by a comma. Create an object of class BookingSystem with size 13 and use the text file to fill the hash table. Then you have to choose an option from a menu. You can add a new passenger by adding a new passenger_Name ticket_ID and ticket_price to the table. You need to check if the ticket ID is valid by checking if it has 6 numbers, underscore) and Two letters. An example of a valid ticket is 120321_KW. You can also Find Ticket, if the passenger_Name exist in the table then return ticket_ID otherwise passenger doesn't have a valid ticket. You can update a ticket_ID using a passenger_Name that exist in the hash table. Add your sample output as a comment at the end of the Test class A menu of choices should be displayed as follows: Welcome to Train Booking System. Enter: 1. Add a new Passenger 2. Find Ticket 3. Update Ticket ID 4. Print Passengers table 5. Find the highest ticket price 6. Quit Sample of Passengers.txt file: Ahmed Omar,120221 KW, 50.500 Mona Salem, 230421_KS, 62.750 Ali Fahd 150221_EG, 105.500 Zahra Sameer, 250521_QT, 77.25 Lama Abdullah, 120721 UK, 140.250 Sample of output: Welcome to Train Booking System. Enter: 1. Add a new Passenger 2. Find Ticket 3. Update Ticket ID 4. Print train booking table 5. Find the highest ticket price 6. Quit 1 Enter the passenger name or "*" to Stop: Aya Bader Enter Ticket_ID of at least 9 characters include letters, numbers and 120321_KW Enter ticket price : 68.5 Enter the passenger name or "*" to Stop: Tamer Hasan Enter Ticket_ID of at least 9 characters include letters, numbers and _: 2304KW Invalid Ticket ID Enter Ticket_ID of at least 9 characters include letters, numbers and _ : 230421_USA Enter ticket price: 594 Enter the passenger name or to Stop: Aya Bader passenger already exist Enter the passenger or "*" to Stop: 2 2 Welcome to Train Booking System. Enter: 1. Add a new Passenger 2. Find Ticket 3. Update Ticket ID 4. Print train booking table 5. Find the highest ticket price 6. Quit 2 Enter the passenger name: Ahmed Omar Passenger Ticket ID is 120221_KW Ticket price is 68 KD Welcome to Train Booking System. Enter: 1. Add a new Passenger 2. Find Ticket 3. Update Ticket ID 4. Print train booking table 5. Find the highest ticket price 6. Quit 2 Enter the passenger name: Sara Ali Passenger doesn't have a ticket Welcome to Train Booking System. Enter: 1. Add a new Passenger 2. Find Ticket 3. Update Ticket ID 4. Print train booking table 5. Find the highest ticket price 6. Quit 3 Enter the passenger name: Aya Bader Enter the new Ticket ID: 060321_TK Enter the new price: 120.250 Ticket update Successful Welcome to Train Booking System. Enter: 1. Add a new Passenger 2. Find Ticket 3. Update Ticket ID 4. Print train booking table 5. Find the highest ticket price 6. Quit 5 The highest ticket price is for Tamer Hasan with ticket_ID 230421_USA: 594 KD Welcome to Train Booking System. Enter: 1. Add a new Passenger 2. Find Ticket 3. Update Ticket ID 4. Print train booking table 5. Find the highest ticket price 6. Quit 4 Train booking table: 0 Aya Bader, 060321_TK, 120.250 1 Tamer Hasan, 230421_USA, 594.000 2 Mona Salem, 230421_KS, 62.750 3 Ahmed Omar, 120221_KW, 50,500 5 Ali Fahd , 150221_EG, 105.500 8 Zahra Sameer 250521_QT, 77.250 10 12 Lama Abdullah, 120721_UK. 140.250 Welcome to Train Booking System. Enter: 1. Add a new Passenger 2. Find Ticket 3. Update Ticket ID 4. Print train booking table 5. Find the highest ticket price 6. Quit 6 Goodbye