Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python (and no .get please unless it actuallt works) Part II: Let Me Inn (20 points) You are the manager of the Let Me Inn.

image text in transcribed

image text in transcribed

Python

(and no .get please unless it actuallt works)

Part II: Let Me Inn (20 points) You are the manager of the Let Me Inn. A travel agent has sent you a list of reservations that can be accommodatec by the hotel. Your primary job is to send him back the total cost of the reservations. To make sure your hotel run: properly, you also will keep track of how much money you have made from each type of room (Normal, Double King, Suite). Complete the function hotel manager which takes arguments in the following order: 1. room.prices: A dictionary that maps a type of room (a string) to the price of the room (an integer). 2. room.counts: A dictionary that maps a type of room (a string) to the number of available rooms of tha type (an integer). 3. reservations: A list of sub-lists wherein the first element of a sub-list contains the type of room being reserved, and the second element is the desired count of rooms of that type. For example, the sub-lis ['King', 3] would indicate that 3 King rooms are desired. The function iterates over the reservations list, extracting the room type and room count of each reservation Room types can appear multiple times in the list. Then, the function looks up the price of the desired room using the room.prices dictionary and determines what it would cost to reserve the desired number of rooms You may assume that the room type in the reservation always has a corresponding price in room-prices anda corresponding count in room.counts If there are enough available rooms to accept the reservation, the function (1) updates the total income generate by the reservation, (2) updates room-counts to reflect that fewer rooms are now available, and (3) updates a dictionary that tracks how much income was generated by each type of room. As an example, suppose that a King room costs $200 per night and 3 have such rooms been successfully reserved. Suppose also that we have createda dictionary called room.incomes to store the income generated by each room type. In this example, the function would add 600 both to room.incomes ['King' 1 and to the total income generated. It would also subtract from room.counts'King'] If a certain reservation in reservations list cannot be accommodated due to a shortage of rooms, the function skips over that reservation and moves on to the next one in the list. At the end, the function returns two values in a tuple: the total income generated by the accepted reservations followed by the updated room.incomes dictionary

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions