Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Inn Room Booking The Golden Dragon Inn has hired you to create an application that allows guests to book rooms. Guests can book either a

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Inn Room Booking The Golden Dragon Inn has hired you to create an application that allows guests to book rooms. Guests can book either a Luxury or Modest room. To book a room the guest making the booking must provide their name, the number of guests (total) staying in the room, the number of beds (total) required, and the number of nights. These four values are to be entered using a JavaFX GUI interface with the following approximate appearance: Inn Room Cost Calculator Name: Number of Guests: Number of Beds: Number of Nights: Welcome to The Golden Dragon Inn! Take note of your check-out time. Enter your information. Once those four text fields are filled in, the user will then click on the appropriate button (Luxury or Modest) to indicate which type of room they want to book. Here is what the interface might look like after clicking the Luxury button: After the "Luxury" button is pressed (as shown above), the application responds by displaying: - A perk to be provided to the guests upon arrival. The software randomly chooses between "Keg of wine" or "Wheel of cheese" for the perk; - The check-out time, which is always 1 pm for Luxury rooms; and - The total cost that is expected for the stay. (More on that in a moment.) Pressing the Reset button returns the application to its original appearance. On the next page is an example of the application after filling in the text fields and then clicking the "Modest" button: After the "Modest" button is pressed (as shown above), the application responds by displaying: - The message "Breakfast included in room cost"; - The check-out time, which for Modest rooms is either 9am or 10am; this is determined randomly at the time the booking is made; and - The total cost that is expected for the stay. (More on that in a moment.) As explained in Module 9, your application's source code will include an eventhandler () method that is automatically called whenever any button is pressed. This method has the following first line: public void eventHandler (ActionEvent event) The event variable defined in that line is your key to determining which button the user has pressed. Consider this line of code: if (event.getsource() == resetButton) Place code inside this 'if statement for handling the reset functionality, and handle the Luxury and Modest buttons in the same way. The cost of a stay is calculated as follows: The Cost of a Luxury Stay: - Luxury stays have a base rate of 30gp (gold pieces) per night for each room, which includes complimentary breakfasts for all guests. The first bed is also included in this price. - Each additional bed has a cost of 10gp per night. - The number of guests does not factor into cost calculations for luxury stays. So for the Luxury example shown above: - 10 nights at 30gp= a base cost of 300gp - plus (41)=3 beds (310=30gpight) for 10 nights is 300gp more - for a total of 300+300=600gp The Cost of a Modest Stay: - Modest stays have a base rate of 10gp (gold pieces) per night for each room. The first two beds are included in this price. - Each additional bed has a cost of 1gp per night. - Each guest is charged 0.5gp per night for breakfast. So for the Modest example shown above: - 7 nights at 10gp= a base cost of 70gp - plus (5-2)=3 beds (31=3gpight) for 7 nights is 21gp more - plus 10 guests @ 0.5 each =5gp/ ight for 7 nights is 35gp more - for a total of 70+21+35=126gp

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions