Monday, 27 October 2025

Dictionaries practice

 

  1. Write a menu-driven program to create a dictionary called HOTEL and provide the following functions:

    a) ADD n rooms to the dictionary HOTEL, where each room description is stored as

    {ROOM_NO : [GUEST_NAME, ROOM_TYPE, NO_OF_DAYS, BILL]}
    • Ensure the ROOM_TYPE => Standard(default), Deluxe, Supreme or Suite

    • BILL → calculated based on room type and number of days

    • Room TypeCost per Day (₹)
      Standard1500
      Deluxe2500
      Supreme3500
      Suite5000

    b) SEARCH for a room using its ROOM_N and increase the stay by 1 day.
    The BILL should be recalculated accordingly. Display ROOM NOT FOUND in case not found

    c) DISPLAY all room records in a tabular form showing:

    Room No | Guest Name | Room Type | Days | Bill
  • Also display the total bill amount collected.