Project 5 objective: The purpose of this lab project is to exposes you to writin
ID: 3824481 • Letter: P
Question
Project 5 objective: The purpose of this lab project is to exposes you to writing programs using functions Problem Specification Given the program specifications in project 3. The PCCC Palace Hotel problem and the included source program (script). you must define the functions that are called from main Oto solve the problem A sample output statement would be: PCCC Palace Hotel Eddie's Billing Statement Invoiced: 246 Number of days in hotel: 2 in a Single Room Room Charges Internet Charges $29.S5 Television Charges (Basic) $8.85 Total Charges S703.70 S24.63 Local Taxes Total Due Thank you for using PCCC Palace Hotel. Hope to see you again. Requirements: Do not modify my main 0 function Include your relevant information in the docstring Follow programming standards as explained in the class( input process output) in all functions. All the rates are defined as local constants and the defined constants are used in calculations. A menu displays the options used for ty and net options. The local tax rate is 3.5% and is defined as a local constant. The function setdatao reads the name, number of days and room number and t them to main The function setroom 0 returns the room type and room charges. The function setnet o and sett Oretums the type used and cost for each The function findtotal 0returns the total cost without taxes. The function o O prints the first 3 lines' information SAExplanation / Answer
def setdata():
name = raw_input("Enter name:")
days = int(input("Enter days"))
rooms= int(input("Enter rooms"))
return name, days, rooms
def setroom(room,days):
roomtype = raw_input("Enter Room type (AC(A)/Regular(R)):")
rate = 200
charges = 0
if(roomtype=='A'):
charges = rate*2*days*room
else:
charges = rate*days*room
return roomtype,charges
def setnet(days):
nettype = raw_input("Enter Net type (WiFi(W)/EtherNet(E)):")
rate = 10
charges = 0
if(nettype=='W'):
charges = rate*0.45*days
else:
charges = rate*days
return nettype, charges
def settv(days):
tvtype = raw_input("Enter TV type (Advaned(A)/Basic(B)):")
rate = 4.5
charges = 0
if(tvtype=='A'):
charges = rate*1.45*days
else:
charges = rate*days
return tvtype, charges
def findtotal(roomcharges,netcharges,tvcharges):
return roomcharges+netcharges+tvcharges
def outputheader(name,days,roomtype):
print "Name : "+name+" Number of days : "+str(days)+" Room Typr : "
if(roomtype=='A'):
print "AC "
else:
print "Regular "
def output(roomcharges,netcharges,nettype,tvcharges,tvtype):
print "Room Charges :"+str(roomcharges)+" "
print "Net Charges ("+nettype+") :"+str(netcharges)+" "
print "TV Charges ("+tvtype+") :"+str(tvcharges)+" "
def outputfooter(totalcharges):
print "Total Charges :"+str(totalcharges)
print "Local Taxes :"+str((totalcharges/100)*3.5)
print "Total Due : "+str(totalcharges+((totalcharges/100)*3.5))
def main():
name, days, rooms = setdata()
roomtype, roomcharges = setroom(rooms,days)
nettype,netcharges = setnet(days)
tvtype,tvcharges = settv(days)
totalcharges = findtotal(roomcharges,netcharges,tvcharges)
outputheader(name,days,roomtype)
output(roomcharges,netcharges,nettype,tvcharges,tvtype)
outputfooter(totalcharges)
main()
input("Press any key to continue")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.