Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Barking Lot is a dog day care center. Design pseudocode for the following: A

ID: 3585822 • Letter: T

Question

The Barking Lot is a dog day care center. Design pseudocode for the following: A program that accepts data for an ID number of a dog's owner, and the name, breed, age, and weight of the dog. Display a bill containing all of the input data as well as the weekly day care fee, which is $55 for dogs under 15 pounds, $75 for dogs from 15 to 30 pounds inclusive, $105 for dogs from 31 to 80 pounds inclusive, and $125 for dogs over 80 pounds. Next, modify the program so that it continuously accepts dogs’ data until a sentinel value is entered, and displays billing data for each dog. Copy the existing pseudocode and paste it into a 2nd page of the same document.

Explanation / Answer

Algorithm BarkingLot:
1. Prompt: "Enter ID for dogs owner: "
2. Read dogOwnerID
3. Prompt: "Enter dog name: "
4. Read dogName
5. Prompt: "Enter dog breed: "
6. Read dogBreed
7. Prompt: "Enter dog age: "
8. Read dogAge
9. Prompt: "Enter dog weight: "
10. Read dogWeight
11. Write dogOwnerID, dogName, dogBreed, dogAge, dogWeight.
12.   if dogWeight < 15:
       weeklyDayCareFee = 55.
   else if dogWeight <= 30:
       weeklyDayCareFee = 75.
   else if dogWeight <= 80:
       weeklyDayCareFee = 105.
   else if dogWeight > 80:
       weeklyDayCareFee = 125.
13. Write weeklyDayCareFee.
14. Stop.

Algorithm BarkingLotRefined:
1. Prompt: "Enter ID for dogs owner (END0000 to quit): "
2. Read dogOwnerID
3. if dogOwnerID == "END0000"
       go to step 16.
4. Prompt: "Enter dog name: "
5. Read dogName
6. Prompt: "Enter dog breed: "
7. Read dogBreed
8. Prompt: "Enter dog age: "
9. Read dogAge
10. Prompt: "Enter dog weight: "
11. Read dogWeight
12. Write dogOwnerID, dogName, dogBreed, dogAge, dogWeight.
13.   if dogWeight < 15:
       weeklyDayCareFee = 55.
   else if dogWeight <= 30:
       weeklyDayCareFee = 75.
   else if dogWeight <= 80:
       weeklyDayCareFee = 105.
   else if dogWeight > 80:
       weeklyDayCareFee = 125.
14. Write weeklyDayCareFee.  
15. Goto step 1.              
16. Stop.