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
customer_name = input("Please enter your first and last name: ")
# Get the pet's name
pets_name = input("Enter the name of the pet (and type): ").strip()
# Welcome message
print(f"
Hello {customer_name} and {pets_name}!")
print("Welcome To Lisha's Paw-sitive Vibes Extended Stay
")
# Display services and their prices
print("Our services and prices:")
print("1. Boarding: $35 per night")
print("2. Walking: $20 per session")
print("3. Daycare: $20 per day")
print("4. Homecheck: $35 per day
")
# Service costs
daycare_cost =20
walking_cost =20
boarding_cost =35
homecheck_cost =35
# Get the service type
service_choice = input("Choose a service (Boarding(B), Walks(W), Daycare(D), Homecheck(h)): ").upper()
# Initialize total
total =0
# Use conditional structure to compute the total bill based on service choice
if service_choice =='B':
nights = int(input("Enter the number of nights for boarding: "))
total = nights * boarding_cost
total = nights * boarding_cost
elif service_choice =='W':
sessions = int(input("Enter the number of walk sessions: "))
total = sessions * walking_cost
elif service_choice =='D':
days = int(input("Enter the number of days for daycare: "))
total = days * daycare_cost
elif service_choice =='H':
days = int(input("Enter the number of days for homecheck: "))
total = days * homecheck_cost
else:
print("Invalid service choice!")
exit()
# Military discount
military_discount = input("Are you prior or current military (yes/no): ").strip().lower()
if military_discount == "yes":
discount_rate =5 # 5% discount
discount_amount =(total * discount_rate)/100
total -= discount_amount
print(f"
Thank you for your service! You received a 5% military discount of ${discount_amount:.2f}.")
elif military_discount =="no":
discount_amount =0
print("
No military discount applied.")
else:
print("
Invalid input. Please enter 'yes' or 'no'.")
exit()
# Display the total cost
print(f"
Your total after discounts is: ${total:.2f}")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!