Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help import javax.swing.JOptionPane; import java.util.Scanner; public class test _ place { public static void main ( String [ ] args ) { / /

Please help
import javax.swing.JOptionPane;
import java.util.Scanner;
public class test_place {
public static void main(String[] args){
// Get user input for starting floor, total floors, and rooms per floor
int firstInputFloor, userTotalFloor, numberOfRoomPerFloor;
firstInputFloor = getIntegerInput("Enter starting floor number (between 3 and 6): ",3,6);
userTotalFloor = getIntegerInput("Enter total number of floors (between 3 and 21): ",3,21);
numberOfRoomPerFloor = getIntegerInput("Enter number of rooms per floor (between 1 and 999): ",1,999);
// Validaeeeet e room numbering based on number of rooms and floors
int maxRoomNumberDigits = userTotalFloor <100?3 : (userTotalFloor >=100 && firstInputFloor <10)?4 : 5;
if (String.valueOf(userTotalFloor).length()> maxRoomNumberDigits){
Above is what i have so far
DO NOT use arrays, methods, or functions for this assignment.
The only import allowed is: import javax.swing.JOptionPane;
Make sure to follow the specified format and requirements closely.Use only concepts covered in class, such as nested for loops and conditional statements.
DO NOT use arrays, methods, or functions for this assignment.
The only import allowed is: import javax.swing.JOptionPane;
Make sure to followA 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.
content-divider.png
The learning goals for this assignment are to:
Understand and implement nested loops for loops in Java.
Practice using conditional statements to format room numbers.
Create a simple text-based room roster for custodians.
checklist.pngAssignment Checklist - HotelRoomEx3:
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.showMessageDialog 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.png
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 top floor 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
Compilation and Evaluation:
Compile your code using the javac command
Evaluate the results using the java command.
Ensure the code compiles without errors. The code must compile without errors to receive any credit.
Iteration:

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

4-3. How does an abstract word differ from a concrete word? [LO-4]

Answered: 1 week ago

Question

4-1. What is meant by the term you attitude? [LO-1]

Answered: 1 week ago