Question
Intro to Java programming: A small airline has just purchased a computer for its new automated reservations system. Youre to write an application to assign
Intro to Java programming:
A small airline has just purchased a computer for its new automated reservations system. Youre to write an application to assign seats on each flight of the airlines only plane with capacity is 3seats (Flight has only one class). Use a constructor to get and set a name of the person and number of seats required for the journey. Implement one run method which handles the seat allocation by checking available seats every time and update the available after allocating seats to a customer. When a customer is trying to reserve a seat check for the availability, if seats are available to proceed with allocation or if the user requested seats are more than available then intimate the customer about the count of available seats and check with his/her if they want to proceed with available seats or not. If the available seats are Zero then prompt a message which says No available seats at this time. Now use the constructor to pass the values and use start method to invoke the run method. Create three threads for one run() method and make sure all threads work simultaneously. Assume that Person_1 is requesting for 1 seat Person_2 is requesting for 2 seats Person_3 is requesting for 1 seat Note: Make sure to update the available seats after every thread execution.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started