Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need to do this assignment in JAVA. Thank you. Hotel Problem Problem: The Nirvana Hotel contain 100 rooms. We wish to create a hotel
I need to do this assignment in JAVA. Thank you.
Hotel Problem Problem: The Nirvana Hotel contain 100 rooms. We wish to create a hotel register that can be used to access cach occupant by name with a minimum amount if scarching. We also wish to keep track of all occupants by room number Assignment: Write a program in Java to accomplish the above objective using the following techniques l. Construct a hash table with a load factor near 90%. For this problem use a table of I 14 elements with subscripts ranging from 0 to 113. 2. Resolve collisions by chaining of empty table positions. 3. Maintain a chain of empty table positions. 4. Use an array of tags to access occupants by room number. 5. Maintain necessary counters to compute the following at the end of the run: a. probes per successful b. probes per unsuccessful search c. probes per scarch (overall) search 6. Use the names given in this handout to initially fill up the hotel. (may be in any order desired 7. Use the action requests given in this handout as the action input cards to your program. These cards must be input to your program in the same order they are listed in this hand out. 8. You must submit flowcharts with your program. The logic involved in maintaining the chains in the hash table can be quite tricky, if you write your flowchart first you may save yourself a lot of agony when you begin testing your program. IAG TABLE FULL CODE HASH TABLE KEY NAME THIS SLOT ROOM WAYS 01 EMPTY, HOLDS ACCESS TO EMPTY CHAIN Zero ndicates 1'HOWARD 0 empty room SINGER 10 JONES HALE JOHNSON 0 0 10 10 DAVIS 0 SMITH 0 12 SIMPLE ARRAYS INDICATING CHAINING AND TAGGING DCL 1 HASH TABLE (0:113). 2 NAMECHAR (36). ' Zeros Indicate DCL TAG (100) FIX BIN (15); ROOM FIX BINEnds of Chains 2 FL 2 BL 2 FULLBIT (1); FIX BIN (15), FIX BIN (15) COLLISION tANDLIN wrH A ClA INED LIST AND AN afrY ChAIN hah nome to produce kev INSERTIMi key position YES occupiad ?. 13 insert Daae No occupant orelgne YES !in empty lot and cbain to key position move present occupant to n mpty alot and adjuat his chairn y poaition haah nae to produce ker re and YES position the dvance dow chain add key position il nam i found adjuat chain YES found in chain adjnat chain around nase position and add thi pos- ition to the empty chain pote: this flowehart is intended to iive Tou re reqnes basic idea of the logic involved. There is ueh sore detail that aunt be added. ACTION REQUEST CARDS DESCRIPTION: 1. FRINT prin th entir haah table in equenc. (including tabl ubaeript) printa room nimber and oceupant in seguenee. requested rooa nmber checks penon into . hotel, i requested roo is 0t evailable, aaign any room available. Also print meage noting paraona. name and asaigned room. 6 eheclo person out of hotel, print mesaage.indicatinig nam and rooa number. alao print error message i peraon is not currently in hotel. locat the roou of an oeeupant, print essag* indicating aa and rooe rmber. .print error Dessage if person not D the hote no^UiReD RERuESTS Fob THis PROGRAM: (follo thi equence) 92 1 58 CECK OUrMAYA^, JOEN 1 CHECKoUTJoFNSON, CaroL FARVER, after laat print requeat, compat probea per earch a requested and print them on your output, Hotel Problem Problem: The Nirvana Hotel contain 100 rooms. We wish to create a hotel register that can be used to access cach occupant by name with a minimum amount if scarching. We also wish to keep track of all occupants by room number Assignment: Write a program in Java to accomplish the above objective using the following techniques l. Construct a hash table with a load factor near 90%. For this problem use a table of I 14 elements with subscripts ranging from 0 to 113. 2. Resolve collisions by chaining of empty table positions. 3. Maintain a chain of empty table positions. 4. Use an array of tags to access occupants by room number. 5. Maintain necessary counters to compute the following at the end of the run: a. probes per successful b. probes per unsuccessful search c. probes per scarch (overall) search 6. Use the names given in this handout to initially fill up the hotel. (may be in any order desired 7. Use the action requests given in this handout as the action input cards to your program. These cards must be input to your program in the same order they are listed in this hand out. 8. You must submit flowcharts with your program. The logic involved in maintaining the chains in the hash table can be quite tricky, if you write your flowchart first you may save yourself a lot of agony when you begin testing your program. IAG TABLE FULL CODE HASH TABLE KEY NAME THIS SLOT ROOM WAYS 01 EMPTY, HOLDS ACCESS TO EMPTY CHAIN Zero ndicates 1'HOWARD 0 empty room SINGER 10 JONES HALE JOHNSON 0 0 10 10 DAVIS 0 SMITH 0 12 SIMPLE ARRAYS INDICATING CHAINING AND TAGGING DCL 1 HASH TABLE (0:113). 2 NAMECHAR (36). ' Zeros Indicate DCL TAG (100) FIX BIN (15); ROOM FIX BINEnds of Chains 2 FL 2 BL 2 FULLBIT (1); FIX BIN (15), FIX BIN (15) COLLISION tANDLIN wrH A ClA INED LIST AND AN afrY ChAIN hah nome to produce kev INSERTIMi key position YES occupiad ?. 13 insert Daae No occupant orelgne YES !in empty lot and cbain to key position move present occupant to n mpty alot and adjuat his chairn y poaition haah nae to produce ker re and YES position the dvance dow chain add key position il nam i found adjuat chain YES found in chain adjnat chain around nase position and add thi pos- ition to the empty chain pote: this flowehart is intended to iive Tou re reqnes basic idea of the logic involved. There is ueh sore detail that aunt be added. ACTION REQUEST CARDS DESCRIPTION: 1. FRINT prin th entir haah table in equenc. (including tabl ubaeript) printa room nimber and oceupant in seguenee. requested rooa nmber checks penon into . hotel, i requested roo is 0t evailable, aaign any room available. Also print meage noting paraona. name and asaigned room. 6 eheclo person out of hotel, print mesaage.indicatinig nam and rooa number. alao print error message i peraon is not currently in hotel. locat the roou of an oeeupant, print essag* indicating aa and rooe rmber. .print error Dessage if person not D the hote no^UiReD RERuESTS Fob THis PROGRAM: (follo thi equence) 92 1 58 CECK OUrMAYA^, JOEN 1 CHECKoUTJoFNSON, CaroL FARVER, after laat print requeat, compat probea per earch a requested and print them on your output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started