Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part II: Let Me Inn (20 points You are the manager of the Let Me Inn. A tranel agent has sent you a list of

image text in transcribed
Part II: Let Me Inn (20 points You are the manager of the Let Me Inn. A tranel agent has sent you a list of rescrvations thait can be accommodated by the hotel. Your primary job is to send him hack the total cost of the reservationm. To make sure your hotel run properly, you also will keep track of how much moncy you have made from each type of room (Noemal, Double King. Suite) Complete the function hotelnanager which takes arguments in the following order: 1. room, prices: A dictionary that mups atype of room Castrig) to the price ofthe toom (in ?taeper). 2. room.counts: A dictionary that maps a type of room (a string) to the sumber of available rooms of that oype fan integer . reservations: A list of sub-lists wherein the first element of a sab-list contains the type of room being reserved, and the second element is the desired count of sooms of that type. For example, the sub-list 'King'31 would indicate that 3 King rooms are desired The functin ileralesover he reservat i ona list, estacting the ?00ttype and men court of each reservation Room types can appe mdple taries inthe list. Then, the funtis looks upthe Poe of the desired room using the room prices dictionary and determines what it would cost to reserve the desired nomher of room You may assume tht he room type in the resenvation always has a corresponding price in room.prices and a coeresponding coent in room.counts If there are enough available rooms to accept the reservation, the function (1) updates the total income gemerated by the reservation. (2) updates room.counts to refflect that fewer rooms are now available, and (3) updates dictionary that tracks how much income w?penerated by each type of mon As an example, suppose that a King room costs $200per nge and 3 have such rooms been successfully reserved Suppose also that we have created a dictionary called room.incomes to store the income penerated by cach room type. In this example, the funstion would add 600 both to roon.Incomsesl"King'1 and to the total income generated. It would also suberact 3 from room.counts ['King the function If a certain reservation in reservations list cannot be accommodaled due to a shortage of room skips over that reservation and moves on to the nest one in the list At the end, the function returns two valoes in a tuple: the total income gemerated by the accepted reservations followed by the updated room.incomes dictionary CSE 101-Spring 2018 Lab 8 Page 3 Examples Return Values Function Call hotel managert Normal' King'1 195 'Suite': 249 'Nornal': 13. Double'1 9 ing S. Suite': I'Suite'Double' : 630) 249. King: 58S I'King'.31. I'Double',61. King"51 King", 3], ['K?ng". 5))) 2007, 1 King' 760 'King': 190, Suite:270),Nonal': 12, Double': 'King':7 'Suite': 3 King' 'Suite': 540 'Double. 71. I'Suste", 211 King': 178, uite: 226Nornal': 11 "Double' : 8''King, . 5, ,Suite": 4}, [(*Suite". 78. King: 890 |,Normal": 540} I'Kng5)1 Suite, 2) 'Normal', 9111 hotelanageromal' 78. Double 106 'King': 193, Suite': 239) 'Nornal': 12 Double' 10. 'King': 6 Suite' 3). I'Suste31. I Double".1. I'King 31. \"Suite', 2]. I'King. . 4. ?,Double," s), Double' 1060 King' 579 Double'71 hotel manager (('Normal : 97. Double:144 King' 185, Suite:242) 'Nornal: 2265. Normal 970, ,King. : 1295) Double*: 7 King:,Suite:4), I Normal-10)I'King' 31, 1 King.41 King 431 hotel manager(( Normal' 73 Double14 King'1 160 Suite: 295) 'Normal 11 820, KG Double 725, 1'Double.51 I'Suite.11I'Double'61 Double"71. I'Suite, 3j1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions