Hotel Room Booking Project

In this mini project, we have multiple options for the user to select the different type of Rooms (VVIP, VIP or Normal). Each room has different charges. Here we can set manually user balance and check user balance on each type of room option charges.

- If user_balance => room_charges then room has been granted to user
- else user_balance will check on each stage (VIP and Normal)
- If still user_balance is < room_charges then message prompted "You don't have enough balance, Thank You"


# ----------------------- CODE --------------------

from random import randint
import time

def displayintro():
    print()
    print()
    print("+++++++++++++++++++")
    print("___________________")
    print("WELCOME TO PC HOTEL")
    print("Lahore, Pakistan")
    print("________________")
    print()

def useroption():
    option = ""
    while option != "1" and option != "2" and option != "3":
        option = input("Please Select Room Options ('1' for VVIP, '2' for VIP, '3' for Normal): ")
    return option

def roomoptions(useroption):
    user_balance = 100
    vvip_room_fare = 1000
    vip_room_fare = 500
    normal_room_fare = 100
   
    if useroption == "1" and user_balance >= vvip_room_fare:
        print("Welcome to VVIP Rooms")
        vvip_room = randint(1,100)
        time.sleep(2)
        print("----------------------------------------------------------")
        print("VVIP Room Number: ",vvip_room," has been reserved for you ")
        print("----------------------------------------------------------")
        user_balance = user_balance - vvip_room_fare
        print("This VVIP Room charges is ",vvip_room_fare, ", and your remaining balance is ",user_balance)
        print("-------------------------------------------------------------------------------------------")

    if useroption == "2" and user_balance >= vip_room_fare:
        print("Welcome to VIP Rooms")
        vip_room_fare = 500
        vip_room = randint(1,100)
        time.sleep(2)
        print("----------------------------------------------------------")
        print("VIP Room Number: ",vip_room," has been reserved for you ")
        print("----------------------------------------------------------")
        user_balance = user_balance - vip_room_fare
        print("This VVIP Room charges is ",vip_room_fare, ", and your remaining balance is ",user_balance)
        print("-------------------------------------------------------------------------------------------")
       
    if useroption == "3" and user_balance >= normal_room_fare:
        print("Welcome to Normal Rooms")
        normal_room_fare = 100
        normal_room = randint(1,100)
        time.sleep(2)
        print("----------------------------------------------------------")
        print("Normal Room Number: ",normal_room," has been reserved for you ")
        print("----------------------------------------------------------")
        user_balance = user_balance - normal_room_fare
        print("This Normal Room charges is ",normal_room_fare, ", and your remaining balance is ",user_balance)
        print("-------------------------------------------------------------------------------------------")
   
    else:
        option = input("You don't have enough balance to reserved room ")

playagain = "yes"
while playagain == "yes" or playagain == "y":
    displayintro()
    choice = useroption()
    roomoptions(choice) #choice is equal to '1' or '2' or '3'
    playagain = input("Do you want to try again???")

Comments

Popular posts from this blog

Asterisk-AMI

Mini-Max Sum solution in Python

Hackerrank Birthday Cake Candles Challenge Solution in Python