You are provided with three functions checkFlightAvailability
, reserveSeat
and processPayment
. These functions simulate the process of checking the availability of a flight, reserving a seat, and processing the payment, respectively. Your task is to create a function called bookFlight
that utilizes these functions to perform the entire flight booking process.
The bookFlight
function should first check the flight availability. If the flight is available, it should proceed to reserve a seat. If the seat reservation is successful, it should then process the payment. Make sure that the function logs the appropriate messages to the console for each step, including any errors that might occur.
Once all three functions have been processed successfully, log the finalSuccessMessage
to the console to indicate that the flight booking process was completed successfully. Additionally, make sure you always log the completionMessage
regardless of the outcome.
Finally, call the function bookFlight
.