Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can I get the java code for this graphical interface please :') Inn Room Booking The Golden Dragon Inn has hired you to create an

Can I get the java code for this graphical interface please :') 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: 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 Luxcury 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 filing 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 () =w 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 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 (4-1)=3 beds (310=30gp/ ight) 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 (52)=3 beds (31=3gp/ night) for 7 nights is 21gp more - plus 10 guests @ 0.5 each =5gpight for 7 nights is 35gp more - for a total of 70+21+35=126gp Using CalculatorFX.java as a starting point for organizing your code, your task to create this Inn Booking JavaFX application. The appearance of your application need not match exactly the pictures shown, but yours must include all the GUI components shown. Either a GridPane or a FlowPane should work to arrange the components. Choose a reasonable starting width and height for the Scene so that everything is visible (i.e. nothing is cut off) when the GUI is first displayed

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

More Books

Students also viewed these Databases questions

Question

Prepare a multipstep income statement for Sheffield Corp.

Answered: 1 week ago