Step-by-step explanation:
The Barking Lot is a dog day care center. Design a flowchart or pseudocode for the following:
a. 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 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.
b. A program that continuously accepts dogs’ data until a sentinel value is entered, and displays billing data for each dog.
c. A program that continuously accepts dogs’ data until a sentinel value is entered, and displays billing data for dog owners who owe more than $100.
Step-by-step solution
100% (7 ratings) for this solution
Step 1 of 5
a) Pseudocode : Code inputs complete data of dog and displays the total amount spend by owner for dog maintenance depending on weight of dog.
start
Declarations
num IDnumber
num age
num weight
num totalbill
string name
string breed
housekeeping()
detailLoop()
stop
housekeeping()
output “ Enter ID number of dog owner”
input IDnumber
output ” Enter dog name”
input name
output ”Enter breed”
input breed
output ”Enter age”
input age
output “Enter weight in pounds”
input weight
return
detailLoop()
if weight > 15 then
totalbill = 55
else
if weight >=15 AND weight <=30 then
totalbill = 75
else
if weight >=31 AND weight <=80 then
totalbill = 105
else
if weight > 80
totalbill = 125
endif
endif
endif
endif
output “ The weekly bill is $ ”,totalbill
retrun
Flowchart:
Detailed loop defines the total bill for dog and displays dog’s information.
b) Pseudocode : Displays total bill and complete details of dog.
start
Declartions
num IDnumber
num age
num weight
num totalbill
string name
string breed
while IDnumber <> 0
housekeeping()
endwhile
detailLoop()
stop
housekeeping()
output “ Enter ID number of dog owner”
input IDnumber
output” Enter dog name”
input name
output”Enter breed”
input breed
output”Enter age”
input age
output “Enter weight in pounds”
input weight
return
detailLoop()
if weight > 15 then
totalbill = 55
else
if weight >=15 AND weight <=30 then
totalbill = 75
else
if weight >=31 AND weight <=80 then
totalbill = 105
else
if weight > 80
totalbill = 125
endif
endif
endif
endif
output “ The weekly bill is $ ”,totalbill
retrun
Detailed loop defines the total bill for dog and displays dog’s information.
c) Pseudocode : Code displays all dog’s owners details having bill more than $100.
start
Declartions
num IDnumber
num age
num weight
num totalbill
string name
string breed
while IDnumber < > 0
housekeeping()
endwhile
detailLoop()
display()
stop
housekeeping()
output “ Enter ID number of dog owner”
input IDnumber
output ” Enter dog name”
input name
output ”Enter breed”
input breed
output ”Enter age”
input age
output “Enter weight in pounds”
input weight
return
detailLoop()
if weight > 15 then
totalbill = 55
else if weight >=15 AND weight <=30 then
totalbill = 75
else if weight >=31 AND weight <=80 then
totalbill = 105
else if weight > 80
totalbill = 125
endif
endif
endif
endif
output “ The weekly bill is $”,totalbill
retrun
display()
if totalbill > 100 then
output<<”More than $100 owners are”, IDnumber
return