Question: Assignment: Create a Java Program with JOptionPane That Generates A Hotel Room Cleaning Roster For The Custodians. A hotel room cleaning roster is like a

Assignment: Create a Java Program with JOptionPane That Generates A Hotel Room Cleaning Roster For The Custodians.
A hotel room cleaning roster is like a schedule for housekeeping staff, detailing when and how each hotel room will be cleaned. This plan ensures that all rooms receive regular cleaning, maintaining a pleasant and hygienic experience for guests. To create your own hotel room cleaning roster, you can use nested loops in Java.
Nested loops in Java involve placing one loop inside another, providing a structured approach for repetitive tasks, especially when dealing with complex data or patterns. Essentially, there's an outer loop that encloses an inner loop. The inner loop completes its iterations for each run of the outer loop, helping you organize and execute cleaning tasks efficiently.
JOptionPane is a Java class in the javax.swing package. It simplifies the creation of dialog boxes for user interaction. JOptionPane provides static methods to display input prompts, messages, and confirmations, making it easy to integrate user interaction into Java applications.
Setting Up:
Open Visual Studio Code (VSC) and create a new file with the class named HotelRoomEx3
Add a comment block at the top, including your name, UIN, section, and date
Java Code:
Write Java code with correct indention and formatting.
Utilize JoptionPane.showInputDialog to prompt the user for starting floor, total number of floors, and total number of rooms per floor.
Use JoptionPane.showllessageDialog to show a message if the user enters an invalid input, guiding them to enter a different number.
Skip the 13th floor due to superstitions.
Utilize nested loops to create the hotel room cleaning roster.
Roster Display:
Ensure the roster has the title "Hotel Room Cleaning Roster" and features two columns: "Room Number" and "Cleaned".
Display each room entry as "room_number
with 3 underscores for checkmarks. Utilize the tab character for alignment.
Insert a blank lines between entries for each floor.
Output the roster to the terminal/powershell.
Your program should generate the roster in the following format:
Hotel Room Cleaning Roster
Room number Cleaned
301
302
303
401
402
403
501
502
503
Floor Requirements:
Confirm that the starting floor falls between 3 and 6.
if not, output to the screen
"Starting floor must be between 3 and 6." and exit.
Validate the total number of floors does not exceed 21.
if not, output to the screen
"Top floor must be between 3 and 21." and exit.
Guarantee the same number of rooms per floor.
Room Numbering:
For floors with fewer than 100 rooms, use a 3-digit room number (e.g.,103). For floors 10 and above, use a 4-digit number (e.g.,1103)
If there are 100 or more rooms per floor, use a 4-digit room number (e.g.,1103) or 5-digits for floors 10 and above.
if there are no rooms or more than 3 digits of rooms per floor output to the screen
"Rooms per floor should be between 1 and 999." and exit.
Comments:
Comment different sections of code for clarity.
File Management:
Save the Java code in a file named HotelRoomEx3.java
 Assignment: Create a Java Program with JOptionPane That Generates A Hotel

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!