Programming Design

Velma and her husband Victor run a full service veterinary clinic. They would like a program to help them calculate costs for their clients. Victor, who is the vet, charges a flat fee of $100 for medical services and a flat fee of $50 for shots. Velma does the grooming. She charges a flat fee of $20 to groom dogs, except for poodles. She charges an extra $15 for poodles. She charges $40 to bathe cats. Velma and Victor also board animals at the clinic. The fee to board a cat is $15/day. A small dog is $20/day. A large dog is $25/day. Velma encourages owners to have their pets groomed while they are being boarded. (Dogs sometimes start to smell after a few days in the kennel, so it's really nice to give them a good bath before the owners pick them up.) In order to entice people to do this, Velma offers a discount for the combination of grooming and boarding. This discount is calculated based on the length of time in the kennel. If they were boarded for 3 days or less, the discount is 10% off the grooming. If they were boarded more than 3 days, then it is a 20% discount. Many times people bring in more than one of their pets at the same time, so make sure the program loops back up if they have more animals. (Hint: Notice the loop here.) The program should print out the total amount for the pet owner. I need to do the pseudocode for this problem.

Answers

// Create a procedure that calculates the total cost for veterinary services PROCEDURE calcTotalCost //Input data for services INPUT flatFeeMedical, flatFeeShots, flatFeeGroomDogs, flatFeeGroompoodles, flatFeeBatheCats, feeBoardCat, feeBoardSmallDog, feeBoardLargeDog //Input data for discount INPUT discountLessThan3, discountMoreThan3 // Initialize total cost totalCost = 0 //Create loop to keep asking the pet owner if there are more animals WHILE all pets not entered //Input type of animal and number of days to be boarded INPUT animalType, boardingNumDays IF animalType = "dog" THEN //Calculate the cost of medical services and shots totalCost = totalCost + flatFeeMedical + flatFeeShots //Calculate the cost for the groom based on type of dog IF animalType == "poodle" THEN totalCost = totalCost + flatFeeGroomPoodles ELSE totalCost = totalCost + flatFeeGroomDogs END IF //Calculate the

Answered by James Johnston

We have mentors from

Contact support