Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please read the question carefully. java language just read it Project: Train Booking System This project will implement a simple passenger/ticket lookup system using Hash

image text in transcribed
please read the question carefully. java language
just read it
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 The index used to store ticket_ID in the hashtable Sum Sum of all characters in the passenger_Name P A constant prime value of 19 Size Size of the hash table Key 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Investing All In One For Dummies

Authors: Eric Tyson

2nd Edition

1119873037, 978-1119873037

Students also viewed these Databases questions