The design should consist of two things:
(1) a list of every semaphore, its purpose, and its initial value,
and
(2) pseudocode for each function. The pseudocode should be similar
to the pseudocode shown in the textbook for the barbershop
problem.
Every wait and signal call must be included in the pseudocode.
Must use Java Threads and Java Semaphores
(java.util.concurrent.Semaphore).
You may not use the “synchronized” keyword in Java for mutual
exclusion.
You may not use Java data structures that have built-in mutual
exclusion.
Please provide corresponding PSEUDOCODE along with JAVA CODE.
Hotel Simulation
A hotel is simulated by using threads and semaphores to model
customer and employee behavior.
This project is similar to the “barbershop” example in the
textbook. The following rules apply:
The hotel to be simulated has two employees at the front desk to
register guests and two bellhops to handle guests’ bags.
A guest will first visit the front desk to get a room number. The
front desk employee will find an available room and assign it to
the guest.
If the guest has less than 3 bags, the guest proceeds directly to
the room. Otherwise, the guest visits the bellhop to drop off the
bags.
The guest will later meet the bellhop in the room to get the bags,
at which time a tip is given.
Threads:
Guest:
1) 25 guests visit the hotel (1 thread per guest
created at start of simulation).
2) Each guest has a random number of bags (0-5).
3) A guest must check in to the hotel at the front
desk.
4) Upon check in, a guest gets a room number from the
front desk employee.
5) A guest with more than 2 bags requires a
bellhop.
6) The guest enters the assigned room.
7) Receives bags from bellhop and gives tip (if more
than 2 bags).
8) Retires for the evening.
Front Desk:
1) Two employees at the front desk (1 thread
each).
2) Checks in a guest, finds available room, and gives
room number to guest.
Bellhop:
1) Two bellhops (1 thread each).
2) Gets bags from guest.
3) The same bellhop that took the bags delivers the
bags to the guest after the guest is in the room.
4) Accepts tip from guest.
Other rules:
1) All mutual exclusion and coordination must be
achieved with semaphores.
2) A thread may not use sleeping as a means of
coordination.
3) Busy waiting (polling) is not allowed.
4) Mutual exclusion should be kept to a minimum to
allow the most concurrency.
5) Each thread should print when it is created, and
main should print when it joins the customer threads.
6) Each thread should only print its own activities.
The guest threads print guest actions and the employee threads
print their own actions.
7) Your output must include the same information, same
wording, and the same set of steps as the sample output. Of course,
each run can be different depending on the order of thread
execution and the random assignments made.
Output
1) Each step of each task of each thread should be
printed to the screen with identifying numbers so it is clear which
threads are involved.
2) Thread output sample for 3 guests. The wording in
your output should exactly match the sample.
Simulation starts
Front desk employee 0 created
Front desk employee 1 created
Bellhop 0 created
Bellhop 1 created
Guest 0 created
Guest 1 created
Guest 2 created
Guest 0 enters hotel with 1 bag
Guest 1 enters hotel with 4 bags
Guest 2 enters hotel with 3 bags
Front desk employee 0 registers guest 0 and assigns room 1
Front desk employee 1 registers guest 1 and assigns room 2
Guest 0 receives room key for room 1 from front desk employee
0
Guest 1 receives room key for room 2 from front desk employee
1
Front desk employee 0 registers guest 2 and assigns room 3
Guest 0 enters room 1
Guest 2 receives room key for room 3 from front desk employee
0
Guest 1 requests help with bags
Guest 0 retires for the evening
Guest 0 joined
Guest 2 requests help with bags
Bellhop 1 receives bags from guest 2
Bellhop 0 receives bags from guest 1
Guest 1 enters room 2
Guest 2 enters room 3
Bellhop 0 delivers bags to guest 1
Bellhop 1 delivers bags to guest 2
Guest 1 receives bags from bellhop 0 and gives tip
Guest 2 receives bags from bellhop 1 and gives tip
Guest 2 retires for the evening
Guest 1 retires for the evening
Guest 1 joined
Guest 2 joined
Simulation ends
In: Computer Science
Java homework problem. This is my hotel reservation system. I'm trying to add a few things to it.
You will be changing your Hotel Reservation system to allow a user to serve more rooms and the rooms will be created as objects.
For this project you will be modifying the Hotel Reservation system to allow a user to serve more rooms and the rooms will be created as objects.
You will be create a Room object that will allow the user to set the type of room, if they want pets, and if they want Oceanview.
OV is $50 more
Pets $25 more
King, Suite and Queen style rooms and you can set the prices
You will have an array for username and password that hold 3 userNames and 3 passwords. These will be parallel arrays. I am allowed to enter username and password 3 times and then I get kicked out.
Main
The main method will keep track of information for 5 room reservations objects all for 1 night
Be sure to use looping, somewhere in the main java file.
Create a method that will catch the object and create it. Remember you can pass by reference or return the object back to the main.
Create a method to handle printing out each of the objects to the screen and the total for each room. (You can set this total in the Room Class if you wish.)
Finally Create a method that will show out the grand total.
Here is my original code to be modified:
import java.util.Scanner;
import javax.swing.JOptionPane;
import java.text.DecimalFormat;
public class hotelreservation {
public static double
roomSelection(Scanner scan)
{
String roomSelection;
System.out.print("Please enter
the type of room desired for your stay (King/Queen/Suite/Two
doubles): ");
roomSelection =
scan.nextLine();
if(roomSelection.equalsIgnoreCase("Suite"))
return
275;
else
if(roomSelection.equalsIgnoreCase("Queen"))
return
150;
else
if(roomSelection.equalsIgnoreCase("King"))
return
150;
else
return
125;
}
public static double roomOceanView(Scanner
scan)
{
String response;
System.out.print("Would you
like an oceanview room (Yes/No) ? ");
response =
scan.nextLine();
if(response.equalsIgnoreCase("Yes"))
return
45;
else
return
0;
}
public static double roomPets(Scanner scan)
{
String response;
System.out.print("Do you have
any pets (Yes/No) ? ");
response =
scan.nextLine();
if(response.equalsIgnoreCase("Yes"))
return
50;
else
return
0;
}
public static void main(String[] args) {
DecimalFormat decFormat = new
DecimalFormat("0.00");
Scanner scan = new
Scanner(System.in);
double roomReservation[] = new
double[3];
double subTotal = 0;
for(int x=0;x
{
System.out.println("Welcome to our Hotel Room Reservation Pricing
System.");
System.out.println("Please answer the following questions regarding
your reservation of room #"+(x+1)+" : ");
roomReservation[x] = roomPets(scan);
roomReservation[x] += roomSelection(scan);
roomReservation[x] += roomOceanView(scan);
}
for(int x=0;x
{
System.out.println("Total cost for room #"+(x+1)+" :
$"+decFormat.format(roomReservation[x]));
subTotal += roomReservation[x];
}
System.out.println("Subtotal:
$"+decFormat.format(subTotal));
double tax =
subTotal*0.05;
System.out.println("Total Tax
(5%): $"+decFormat.format(tax));
System.out.println("Grand
Total: $"+(decFormat.format(subTotal+tax)));
scan.close();
}
}
In: Computer Science
On April 1, 2020, Dalinar Company began construction on a new distribution warehouse. Construction was completed on December 31, 2020, at which time the building was placed in service. Dalinar made an initial payment toward construction on April 1, 2020 of $240,000 and made additional payments $30,000 every two months thereafter, beginning on June 1 and continuing through December 1. A final payment of $100,000 was made on December 31 at the completion of construction. Dalinar borrowed $150,000 at 4% on April 1 to partially finance the previously mentioned payment on that date. All other construction costs were paid using cash on hand.
The only other liability currently owed by Dalinar is a long-term, $120,000 note payable with principal due on December 31, 2024. The long-term note was issued at face-value, has a stated rate of 6%, and has interest payable annually every 12 months at October 31. At the time the note was issued, the market rate for similar notes was 6%.
What are the weighted average accumulated expenditures for the year?
What is Dalinar's capitalized interest on specific debt?
What is Dalinar's capitalized interest on non-specific debt?
In: Accounting
Ventram, Inc. decided to open a new retail outlet in a
neighboring town. On January 1, 2019, Ventram took out a
$400,000 construction loan and purchased the land on January 15,
2019. Construction for the new store began on March 1,
2019. The company expected to complete construction in
early 2020. Information about 2019 construction
expenditures and details about Ventram’s debt structure are
included below.
| Ventram Construction Expenditures - 2019 | ||
|---|---|---|
| Land purchase | Jan. 15, 2019 | $200,000 |
| Payment for excavation and foundation work | Mar. 31, 2019 | 50,000 |
| Payment for framing, electrical, plumbing, etc. | June 30, 2019 | 350,000 |
| Payment for drywall, fixtures, etc. | Dec. 31, 2019 | 150,000 |
| Ventram Debt Structure - 2019 | |||
|---|---|---|---|
| Contruction loan for retail building project | Jan. 1, 2019 | $400,000 | 6% |
| Note payable | Mar. 31, 2018 | 350,000 | 8% |
| Bond payable | Oct. 31, 2018 | 250,000 | 10% |
What was the total weighted average accumulated expenditure for the Ventram project? What was the weighted average interest rate on general debt (non-project specific)?
a. $379,167; 8.83%
b. $404,167; 9.00%
c. $404,167; 7.70%
d. $550,000: 8.83%
e. $379,167: 7.70%
In: Accounting
Search the internet and compare these three colleges for the following information. (1. Stanford, 2. Harvard, 3.Yale)
In: Statistics and Probability
Barton Industries has operating income for the year of $3,400,000 and a 39% tax rate. Its total invested capital is $20,000,000 and its after-tax percentage cost of capital is 7%. What is the firm's EVA?
In: Finance
Britton Carter is interested in building a new hotel in Queenstown, New Zealand. His company estimates that the hotel would require an initial investment of $20 million, would produce a positive cash flow of $6.5 million a year and at the end of each of the next 15 years can be salvaged (after tax) $10 million at t=15. The company recognizes that the cash flow could in fact be much higher or lower depending on whether that area becomes a popular tourist area. It is believed that at the end of two years, a 15% chance exists in the tourism will not be spreading in that direction and yearly cash flow will be only $2.5 million for 15 years within after-tax salvage value of $7 million and 85% chance exists that tourism will be heading that way in the yearly cash flow will be $8.5 million for 15 years with an after-tax salvage value of $18 million. If the firm waits two years, the initial investment will be $25 million. The project's cost of capital is 12%. Should the firm proceed with the project today or should it wait two years before deciding? (Round NPVS to the nearest dollar) choose the closest answer
A. wait two years, the NPV of building today is $2,745,595 worst in the NPV for waiting two years.
B. Build it now since the NPV of building today is $2,38,340 better than the NPV for waiting two years
C. Wait two years the NPV of building today is $3,652,072 worst in the NPV for waiting two years
D. Build it now since the NPV of building today is $4122163 better than the NPV of waiting two years
E. Build it now since the NPV a building today is $1,580,882 better than the MPV for waiting two years
In: Finance
The typical supermarket has 30,000 different products on sale at any given time. The manager of that supermarket must determine not only what mix of products to have on hand but where to locate those products and what price to set on each one at any specific time. Usually, the price is based on a markup on the cost of the item, and the only reason the price is altered is that costs change. When you reserve a hotel room, you find that there are several different prices offered for that same room, depending on whether you work for the government, are a member of AARP or some other organization, are staying more than one night, and so on. Why doesn’t the hotel just offer a single price? These examples illustrate just a few of the many problems confronting businesses in their relations with customers. Companies do not seem to know much about their customers. For instance, companies often base prices on the anecdotal evidence of a few vocal salespeople or product managers. Even Mercedes-Benz, when it was about to launch one of its A-class models in the German market, initially proposed a price tag of DM29,500, based on little more than the belief that DM30,000 was a psychologically important barrier. Consultants point out that price has a disproportionate effect on the bottom line, far more than greater volume or cuts in fixed and variable costs. Assuming that volumes stay constant, a 1 percent price increase produces between an 8 percent and 11 percent improvement in operating profits.
So does this mean that most businesses should raise their prices? Explain your answer.
Are these businesses leaving money on the table—that is, not generating the greatest revenue they could by knowing the customer better?” Explain your answer.
In: Economics
El Durazno is the only resort hotel on a small desert island off the coast of South America. It faces two market segments: bargain travelers and high-end travelers. The demand curve for bargain travelers is given by ??? = 400 ? 2???. The demand curve for high-end travelers is given by ??? = 500 ? ???. In each equation, Q denotes the number of travelers of each type who stay at the hotel each day, and P denotes the price of one room per day. The marginal cost of serving an additional traveler of either type is $20 per traveler per day.
a. Under the assumption that there is a positive demand from each type of traveler, what is the equation of the overall market demand curve facing the resort?
b. What is the profit-maximizing price under the assumption that the resort must set a uniform price for all travelers? For the purpose of this problem, you may assume that at the profit-maximizing price, both types of travelers are served. Under the uniform price, what fraction of customers are bargain travelers, and what fraction are high end?
c. Suppose that the resort can engage in third-degree price discrimination based on whether a traveler is a high-end traveler or a bargain traveler. What is the profitmaximizing price in each segment? Under price discrimination, what fraction of customers are bargain travelers and what fraction are high end?
d. The management of La Durazno is probably unable to determine, just from looking at a customer, whether he or she is a high-end or bargain traveler. How might La Durazno screen its customers (i.e., cause them to self-identify type through their choices) so that it can charge the profit-maximizing discriminatory prices you derived in part (c)?
In: Economics
Following a serious accident at one of its construction sites, Acme Construction is sued by the family of one of its employees, who was gravely injured. The injured employee is unable to return to work and has been declared permanently disabled. OSHA investigated the accident and has assessed a $500,000 fine against Acme for violation of workplace safety standards. This is not the first time OSHA has assessed fines against Acme. Acme maintains a workers compensation insurance policy, with employer liability (EL) limits of $1,000,000 per accident/disease/injury. Under the EL portion of Acme’s insurance policy, which of the following could potentially be covered:
|
The OSHA fine/penalty |
||
|
The family's lawsuit |
||
|
The injured worker's disability payments |
||
|
Costs to remediate the hazardous conditions that led to the accident |
In: Operations Management