Results 1 to 3 of 3
  1. #1
    xswtnsour13x is offline Member
    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Default Help with writing program to calculate occupancy rate for each floor of a hotel

    I am new to JAVA and so far, we've only done 3 -4 codes by ourselves and each time, I am pretty sure I failed. What I need help for is this code. How do I get started? Help step by step please.

    Question: Hotel Occupancy

    A hotel's occupancy rate is calculated as follows:

    Occupancy rate = number of rooms occupied / Total number of rooms

    Each floor has its floor occupancy rate, and the hotel also has overall occupancy rate.

    Write a program that calculate the occupancy rate for each floor of a hotel and the overall occupancy rate of the hotel. The program should start by asking for the number of floors (must be no less than 1). A loop should then iterate once for each floor. During each iteration, the loop should ask the user to enter the number of rooms on the floor and the number of them that are occupied (each floor must have at least 10 rooms). The the program will calculate and display the occupancy rate for that floor. After all the iterations, the program should calculate the overall occupancy rate of the hotel. Then program should display the total number of rooms the hotel has, the total number of rooms that are occupied, the total number of rooms that are vacant, and the overall occupancy rate for the hotel.

    For example, suppose a hotel has 2 floors.

    first floor: 100 rooms, 80 occupied. Then occupancy rate is 80%

    second floor: 80 rooms, 52 occupied. The occupancy rate is 65%

    The hotel has 180 rooms together, 132 occupied, 48 vacant, the overall occupancy rate is 73.3%



    Input validation: do not accept a value less than 1 for the number of floors. Do not accept a number less than 10 for the number of rooms on a floor. The number of rooms occupied on a floor cannot be greater than the number of rooms on that floor.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Help with writing program to calculate occupancy rate for each floor of a hotel

    1. Open your IDE
    2. Write your code.
    3. Execute your code and debug.
    4. Fix the bugs.
    5. Turn in the assignment.

  3. #3
    XNOViiCE's Avatar
    XNOViiCE is offline Member
    Join Date
    Sep 2013
    Posts
    24
    Rep Power
    0

    Default Re: Help with writing program to calculate occupancy rate for each floor of a hotel

    masijade. For a little help to get you rolling though xswtnsour13x. You will want to prompt the input of how many floors and then put the numbers of floors into a for loop. In the for loop you will do this equation Occupancy rate = number of rooms occupied / Total number of rooms. I think you are smart enough to figure out the rest.

Similar Threads

  1. Cant figure out why my program wont calculate
    By BornToCode in forum New To Java
    Replies: 3
    Last Post: 07-11-2013, 05:25 AM
  2. Replies: 5
    Last Post: 02-19-2013, 02:16 AM
  3. Program in Java To calculate GCD of n numbers.?
    By ankitsinghal_89 in forum New To Java
    Replies: 4
    Last Post: 02-15-2011, 09:23 AM
  4. How to calculate the sample rate of an audio file?
    By arnab321 in forum CLDC and MIDP
    Replies: 0
    Last Post: 12-28-2008, 12:39 PM
  5. Why my program cannot calculate the decimal value?
    By pearllymary78 in forum New To Java
    Replies: 4
    Last Post: 06-23-2008, 12:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •