Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

I what is the problem with this program??

+16 votes
asked Mar 28, 2025 by PRAISY A (340 points)
print("********************************")
print("***********Booking system************")
print("*********************************")
Checker="Y"
while Checker=="Y"
cusname =input("Enter Customer Name")
gender=input("what's customer gender")
phone=input("Enter customer phone number")
print("*********************************")
print("select room type: 1 for normal-#7,000,2 for master-#12,000,3 for prime-#20,000")
rchoice=int("input(select room type: "))
if rchoice==1:
    pay=float(7,000)
elif rchoice==2
    pay=float(12,000)
elif rchoice==3
    pay=float(20,000)
 else:
    print("wrong entry")
    break
no room=foat("input(Enter the number of rooms:"))  
days=float(input("Enter the number of day(s) you will be staying:"))
tpay=pay*no room*days
checkin=input("Enter check-in time:")
checkout=input("Enter check-out time:")
from datetime import date
TransDate=date today()
developer="Praise Agwu"
print()
print("************************************")
print("*********CUSTOMER BOOKING RECIEPT**********")
print("********************************************)
print(f"Transaction date:{transDate}")
print(f"customer name:{cusname}")
print(f"customer gender:{gender}")
print (f"phone No:{phone No}")
print(f"room type:{rchoice}")
print(f"Amount per room:{pay}")
print(f"No of room(s) requested:{no room}")
print(f"No of day(s):{days}")
print(f"check-in time:{checkin}")
print(f"check-out time:{checkout}")
print(f"Total amount:{tpay}")
print()
print(f"program Developer:{developer}")
print()
print(Do you want to enter another record? Y for  yes ,any other key to quit)
opt=input()
checker=opt.upper()
if checker!="Y":
   break

3 Answers

0 votes
answered Mar 28, 2025 by Peter Minarik (101,340 points)
edited Mar 28, 2025 by Peter Minarik

Identifier names

  1. Identifiers cannot have space in the name. So instead of "no room" you should call your variable noRoom or no_room, etc.
  2. Identifiers are case-sensitive, so "Checker" and "checker" are two different variables.

Syntax

  1. Line 5 needs a colon at the end:
    while checker == "Y":
  2. Line 11 has the string beginning quote in the wrong place. A closing parenthesis is also needed. It should be
    rchoice = int(input("select room type: "))
  3. Line 21 also has the wrong quotes matching. It should be
    noRoom = float(input("Enter the number of rooms:"))
  4. Line 22 needs a closing parenthesis
  5. Line 27 needs a dot before the function call:
    TransDate = date.today()
  6. Line 32 is missing a closing quote. It should be
    print("********************************************")
  7. if needs to end with a colon. E.g.: elif rchoice == 2:
  8. Line 36 has the wrong variable name. It should be:
    print (f"phone No:{phone}")
  9. There is no need for the last 2 lines, if the checker casing issue is resolved.
  10. Imports usually go to the top of the file (line 26 should be at the top of the file).
  11. Line 47 needs quotes for the string:
    print("Do you want to enter another record? Y for  yes ,any other key to quit")

Logic

  1. number of rooms and number of days shouldn't be a float, it should be int.
0 votes
answered Apr 19, 2025 by cpp guy (1,020 points)

on line 5 at the end of the if statement, you need a colon

on line 11, you used the wrong bracket number 

your version --> rchoice=int("input(select room type: "))

new version --> rchoice=int("input(select room type: ")

on line 21, you misspelt the variable type for 'float' which you put as 'foat'

also on line 21, you initialised a variable that had a space in its name, this is not allowed in Python.

also on line 21, you put the quotes after the first bracket float("input... the correct version is float(input("...

on line 27, you need a dot between 'date' and 'today'

you were missing quotes for 'print' statement on lines 32 and 37

one line 4, you initialised a variable named "Checker" which you later referenced in line 49, but it was referenced as "checker". Identifiers are case sensitive so "Checker" and "checker" are different things

I don't have time to point anymore errors out. You could also try running the program and fixing the errors as the compiler told you

commented Apr 26, 2025 by Jaden Nwagbo (120 points)
IN the end your code should look like this:
print("********************************")
print("*********** Booking System ************")
print("*********************************")

from datetime import date

# Function to get room price based on choice
def get_room_price(choice):
    if choice == 1:
        return 7000
    elif choice == 2:
        return 12000
    elif choice == 3:
        return 20000
    else:
        return None

# Main booking loop
checker = "Y"
while checker.upper() == "Y":
    # Gather customer information
    cusname = input("Enter Customer Name: ")
    gender = input("What's the customer's gender? ")
    phone = input("Enter customer phone number: ")
    print("*********************************")
    
    # Room type selection
    print("Select room type: 1 for normal (#7,000), 2 for master (#12,000), 3 for prime (#20,000)")
    rchoice = int(input("Input (select room type): "))
    
    # Get room price
    pay = get_room_price(rchoice)
    if pay is None:
        print("Wrong entry for room type.")
        continue  # Restart the loop if the entry is wrong

    # Get number of rooms and days
    no_of_rooms = int(input("Enter the number of rooms: "))
    days = int(input("Enter the number of day(s) you will be staying: "))
    
    # Calculate total payment
    tpay = pay * no_of_rooms * days
    checkin = input("Enter check-in time: ")
    checkout = input("Enter check-out time: ")
    
    # Get transaction date
    trans_date = date.today()
    developer = "Praise Agwu"
    
    # Print receipt
    print()
    print("************************************")
    print("********* CUSTOMER BOOKING RECEIPT **********")
    print("********************************************")
    print(f"Transaction date: {trans_date}")
    print(f"Customer name: {cusname}")
    print(f"Customer gender: {gender}")
    print(f"Phone No: {phone}")
    print(f"Room type: {rchoice}")
    print(f"Amount per room: {pay}")
    print(f"No of room(s) requested: {no_of_rooms}")
    print(f"No of day(s): {days}")
    print(f"Check-in time: {checkin}")
    print(f"Check-out time: {checkout}")
    print(f"Total amount: {tpay}")
    print()
    print(f"Program Developer: {developer}")
    print()
    
    # Ask if the user wants to enter another record
    opt = input("Do you want to enter another record? Y for yes, any other key to quit: ")
    checker = opt.upper()
0 votes
answered May 5, 2025 by Afia Raymond (350 points)
checker and Checker are different and any two words need an underscore else they will be two different variables
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...