## Question

In a manufacturing firm, monthly bonus is given to workers based on their production quantities.

For every 100 units beyond the minimum of 1000 units up to maximum of 2000 units, $50 bonus is paid

(e.g. worker with 1524 output units will get a bonus of $250).

Write code to find a hotel's occupancy_ rate.

Hotel occupancy rate = number of rooms occupied / total number of rooms

Your program needs to

1. Get the number of floors in a hotel.

2. A loop should iterate once for each floor. In each iteration,

a) Get the number of rooms in that floor

b) Get the number of rooms occupied in that floor(user enters 0 if no room is occupied in that floor)

c) Maintain a running total

i. Total number of rooms

ii. Total number of occupied rooms

3. After all the iterations are done, the program should display:

a) The total number of rooms in that hotel

b) The total number of rooms that are occupied

c) The total number of rooms that are vacant

d) The occupancy rate of the hotel

Given a number of tickets sold at each level and priced at $50/$30/$20, compute the total sales. Please add 8.25% sales tax as well. If possible, round off to 2 decimal digits in the output.

The code you write should work for all inputs (not just the sample inputs)

Here is the sample _prompt input & output:

# of first-class tickets: 5

# of second-class tickets: 6

# of regular class tickets: 14

Total revenue: $768.58

Explanation for your understanding

(50*5 + 30*6 + 20*14 = 250 + 180 + 280 = 710

tax : 8.25% of 710 is 58.22

SO total revenue is 710 + 58.22

1) Write a while loop that lets user enter a number that is less than 100.

That number should be multiplied by 10 and result stored in a variable called product.

The loop should iterate as long as the product contains a value less than 1000.

2) We are in charge of reporting Perot Museum's revenue for a day. There are four categories of patrons:

Age 0 through 4 : Kids - no charge(S0)

Age 5 through 18 : Students - $5

Age 19 through 64 : Adults - $20

Age 65 & above : Seniors - $10

Input age of each patron (end of input denoted by -1

Things to do

1. Keep doing steps a,b until the end of input is reached

a) Get the age of the patron

b) Determine which category that patron falls into & increase the number for that category

2. Once end of input is reached

a) Calculate the revenue generated for each category (number of patrons in a category * rate for that category)

b) Calculate the total revenue for the day (sum of revenues of all 4 categories)

3. Generate output in the given format

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.Scanner;public class BonusCalculator {

/**

* Main function acts as the entry point of

* the program.

* @param args

*/

public static void main(String[] args) {

// Creating a scanner object to read user inputs from console

Scanner scanner = new Scanner(System.in);

// Printing message on console

System.out.print("Output units: ");

// User provides number of units

int units = scanner.nextInt();

// Initial bonus is 0

int bonus = 0;

// Checking if number of units are above 1000

if(units > 1000) {

// If units crosses the max limits

// Calculates bonus up to 2000 only

if(units > 2000) {

bonus = 10*50;

}else {

// Otherwise, calculating multiples of 100 and multiplying by 50.

bonus = 50 * ((units-1000)/100);

}

}...

By purchasing this solution you'll be able to access the following files:

Solution.zip.