Question: Here is a copy of my code below, how do I add explanatory comments to help others understand your code - Organizes the code into
Here is a copy of my code below, how do I add explanatory comments to help others understand your code
Organizes the code into functions for each main task
Uses a loop to let customers book multiple services
Stores the services and prices in a dictionary
Also how do I add a code that calculates dates that they are trying to schedule that repeats at the output?
My code:
# Get the customer's name
customername inputPlease enter your first and last name:
# Get the pet's name
petsname inputEnter the name of the pet and type: strip
# Welcome message
printf
Hello customername and petsname
printWelcome To Lisha's Pawsitive Vibes Extended Stay
# Display services and their prices
printOur services and prices:"
print Boarding: $ per night"
print Walking: $ per session"
print Daycare: $ per day"
print Homecheck: $ per day
# Service costs
daycarecost
walkingcost
boardingcost
homecheckcost
# Get the service type
servicechoice inputChoose a service BoardingB WalksW DaycareD Homecheckh: upper
# Initialize total
total
# Use conditional structure to compute the total bill based on service choice
if servicechoice B:
nights intinputEnter the number of nights for boarding:
total nights boardingcost
total nights boardingcost
elif servicechoice W:
sessions intinputEnter the number of walk sessions:
total sessions walkingcost
elif servicechoice D:
days intinputEnter the number of days for daycare:
total days daycarecost
elif servicechoice H:
days intinputEnter the number of days for homecheck:
total days homecheckcost
else:
printInvalid service choice!"
exit
# Military discount
militarydiscount inputAre you prior or current military yesno: striplower
if militarydiscount "yes":
discountrate # discount
discountamount total discountrate
total discountamount
printf
Thank you for your service! You received a military discount of $discountamount:f
elif militarydiscount no:
discountamount
print
No military discount applied."
else:
print
Invalid input. Please enter 'yes' or no
exit
# Display the total cost
printf
Your total after discounts is: $total:f
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
