Update our Doggy Daycare logic: pseudocode and Flowchart, to now continue to process customer bills until a sentinel loop control variable

Update our Doggy Daycare logic: pseudocode and Flowchart, to now continue to process customer bills until a sentinel loop control variable (pgs. 21, 171) is entered for: input ID number of the dog's owner = 0. Once the user enters 0 for the dog owner's ID, the program exits the loop and ends the processing of customer bills. Write a Python program for a Doggy Daycare facility that needs a program to print a customer's bill. The program accepts input data for an ID number of the dog's owner, dog name, dog breed, dog age, and dog weight. Display a bill containing all the input data items as well as the weekly daycare fee, which is 55.00/wkfordogsunder15pounds,75.00 for dogs from

The Correct Answer and Explanation is:

ChatGPT said:

✅ Correct Answer: Python Program, Pseudocode, and Flowchart Update


📌 Updated Requirements Summary:

You are tasked with updating the Doggy Daycare billing system to:

  • Process multiple customer bills in a loop.
  • The loop terminates when the ID number of the dog’s owner is entered as 0 (sentinel value).
  • Each bill contains the following:
    • Dog owner’s ID number
    • Dog’s name, breed, age, weight
    • A fixed weekly fee of $75.00
  • Once 0 is entered as the ID number, the program should stop processing and exit.

🧠 Pseudocode

plaintextCopyEditSTART
  REPEAT
    Prompt user: Enter dog owner's ID number
    READ owner_id

    IF owner_id == 0 THEN
      EXIT LOOP

    Prompt user: Enter dog's name
    READ dog_name

    Prompt user: Enter dog's breed
    READ dog_breed

    Prompt user: Enter dog's age
    READ dog_age

    Prompt user: Enter dog's weight
    READ dog_weight

    SET weekly_fee = 75.00

    DISPLAY bill:
      Owner ID
      Dog's Name
      Dog's Breed
      Dog's Age
      Dog's Weight
      Weekly Fee

  UNTIL owner_id == 0
END

💻 Python Program

pythonCopyEditdef print_doggy_daycare_bill():
    WEEKLY_FEE = 75.00

    while True:
        owner_id = int(input("Enter the dog owner's ID number (0 to quit): "))
        
        if owner_id == 0:
            print("Exiting billing system. Goodbye!")
            break

        dog_name = input("Enter the dog's name: ")
        dog_breed = input("Enter the dog's breed: ")
        dog_age = input("Enter the dog's age: ")
        dog_weight = input("Enter the dog's weight: ")

        print("\n--- Doggy Daycare Bill ---")
        print(f"Owner ID     : {owner_id}")
        print(f"Dog's Name   : {dog_name}")
        print(f"Dog's Breed  : {dog_breed}")
        print(f"Dog's Age    : {dog_age}")
        print(f"Dog's Weight : {dog_weight}")
        print(f"Weekly Fee   : ${WEEKLY_FEE:.2f}")
        print("--------------------------\n")

print_doggy_daycare_bill()

🧾 Explanation (Textbook Style, ~300 words)

This program is designed to automate billing for a Doggy Daycare facility. It repeatedly collects information from the user about different dogs and prints a formatted bill for each. The billing process continues until the user signals the end by entering a sentinel value — 0 — for the dog owner’s ID number.

To manage this, a while loop is used. The loop begins by asking the user to input the dog’s owner’s ID. If the ID is 0, the loop immediately breaks, and the program exits gracefully. This approach ensures that customer data is processed continuously without restarting the program each time.

Inside the loop, the program collects data on the dog’s name, breed, age, and weight. These inputs are stored in variables and then displayed in a neatly formatted bill. The weekly daycare fee is fixed at $75.00, so this value is declared as a constant (WEEKLY_FEE) at the beginning.

Each bill includes all relevant data and presents it clearly for the customer. Formatting such as f"${WEEKLY_FEE:.2f}" ensures that currency is displayed to two decimal places.

This structure is scalable, efficient, and user-friendly. By using a sentinel-controlled loop, the program avoids hardcoding a number of customers and remains flexible to varying input amounts — a best practice in real-world applications.


🔄 Flowchart Structure

plaintextCopyEdit      [Start]
|
v
[Input Owner ID Number]
|
v
[Is Owner ID == 0?]--Yes-->[End]
| No
v
[Input Dog Name]
|
[Input Dog Breed]
|
[Input Dog Age]
|
[Input Dog Weight]
|
[Display Bill]
|
v









Scroll to Top