Input Validation: Do not accept a number less than one for the number of floors. Do not accept a number less than 10 for the number of rooms on a floor. The equation is: Occupancy rate = number of rooms occupied / total number of rooms. As far as the code is concerned, I think it is good except I don't know how to make it to iterate once for each floor. Here's what I have:

import javax.swing.JOptionPane; //needed for GUI import java.text.DecimalFormat; //needed to format the Output /** Lab 3 I am Divy Tolia and this is Lab Assignment 3 located on page 243 problem number 7. The following program will: - Ask the user the number of floors in the hotel - The number of rooms per floor - The number of rooms that are occupied per floor - Calculate and Display the number of rooms that are occupied, number that are vancant,number of rooms in the hotel, and the hotel room occupancy rate. Created by Divy Tolia. */ public class HotelOccupancy {//Begin class public static void main(String[] args) {//Begin main method String input; //To hold the user's input final int MIN_FLOORS = 1; //Minimum amount of floors final int MIN_ROOMS = 10; //Minimum amount of rooms per floor int floors, //Number of floors in hotel rooms, //Number of available rooms in each floor occrooms, //Number of rooms occupied totalrooms, //Number of total rooms vacant; //Number of vacant rooms double occrate; //Occupancy rate DecimalFormat formatter = new DecimalFormat("#,##0.00");// Rounds the answer to two decimal places //Get the number of floors in the hotel JOptionPane.showMessageDialog(null, "How many floors are in the hotel? ","Number of Floors?",JOptionPane.INFORMATION_MESSAGE); //Validate the number entered. do{ input = JOptionPane.showInputDialog("The number of floors " + "must be at least " + MIN_FLOORS); floors = Integer.parseInt(input); }while (floors < MIN_FLOORS); //Get the number of rooms in each floor JOptionPane.showMessageDialog(null, "How many rooms are on each floor?","Number of Rooms per Floor",JOptionPane.INFORMATION_MESSAGE); //Validate the number entered. do{ input = JOptionPane.showInputDialog("The number " + "of rooms must be greater than " + MIN_ROOMS); rooms = Integer.parseInt(input); }while(rooms < MIN_ROOMS); //Get the amount of rooms occupied. String value; value = JOptionPane.showInputDialog(null,"How many rooms are occupied?","Rooms Occupied per Floor",JOptionPane.INFORMATION_MESSAGE); occrooms = Integer.parseInt(input); totalrooms = (floors * rooms); //Calculate the Number of rooms occrate = ((double)occrooms / totalrooms); //Calculate OccupancyRate vacant = (totalrooms - occrooms); //Calculate the Number of rooms Vacant //Display the results JOptionPane.showMessageDialog(null, "\tThere are " + totalrooms + "\t\nin the hotel." + "\t\nThe number of rooms occupied are " +occrooms+ "\tThe Number of rooms that are vacant are"+vacant + "\t\nrooms." + "\t\nThe occupancy rate for the hotel is " + formatter.format(occrate),"Results",JOptionPane.INFORMATION_MESSAGE); //End the program. System.exit(0); }//End main method }//End class