Question: It is often said that one year for humans is equivalent to about seven years for a dog, but this is not altogether true.






It is often said that one year for humans is equivalent to about seven years for a dog, but this is not altogether true. First of all, dogs mature a great deal in their first year: a one-year old dog is equivalent in physical maturity to a 15-year old human. Second, larger dogs age more quickly later in life than smaller dogs: a small 10-year old dog is equivalent to a 56- year old person, while a large dog of the same age is more like a 66-year old person. 1. 2. 3. 4. Repeatedly prompt the user for the weight of their dog until the user enters a weight that is greater than zero. Display the age of the dog using the name that the user entered in step 2. Repeatedly ask the user if they want to calculate the age of another dog until the user answers Y or N. If the user enters Y, go back to step 2. 8. If the user enters N, display a thank you message and exit the program. Any time the user enters invalid input the program should display an error message before prompting them again. 5. 6. Display a welcome message with your name in it. Prompt the user for the name of the dog. Repeatedly prompt the user for the age of the dog until the user enters a value is between 1 and 16. 7. According to WebMD, the age of a dog can be calculated approximately using the following rules: If the dog is 1 year old, the equivalent human age is 15. If the dog is between 2 and 5 years old, the equivalent human age is 4 times the dog's age plus 16. If the dog is between 6 and 16 years old, the equivalent human age depends on the weight of the dog: If the dog weighs 20 lbs or less, the equivalent human age is 4 times the dog's age plus 16. If the dog weighs between 21 and 50 lbs, the equivalent human age is 4.5 times the dog's age plus 15. If the dog weighs more than 50 lbs, the equivalent human age is 7.5 times the dog's age. 1. Start by implementing the prompts for input without any input validation. Next, determine the logic of how to break down the dog age calculation into individual cases and implement that. Write code to output the result. Test your code with multiple cases to make sure it works. Add in input validation for the age and weight. Test your code to make sure the input validation works. Add the code that repeats the process if the user enters Y. Test your code to make sure it works with multiple dogs. 9. Add the input validation to make sure the user enters Y or N. 10. Test your code to make sure the input validation works. 2. 3. 4. 5. 6. 7. 8. Example Input and Output Here is a sample of output for a single run of the program Welcome to Nicholas Coleman's Dog Age Calculator! Please enter the name of your dog: Fluffy Please enter the actual age of your dog (1-16): 3 Please enter your dog's weight in pounds: 15 Fluffy's age in human years is 28 Would you like to calculate the age of another dog? (Y/N): Y Please enter the name of your dog: Iggy Please enter the actual age of your dog (1-16): 8 Please enter your dog's weight in pounds: 45 Iggy's age in human years is 51 Would you like to calculate the age of another dog? (Y/N): Y Please enter the name of your dog: Sadie Please enter the actual age of your dog (1-16): 28 Error: age is out of range Please enter the actual age of your dog (1-16): 14 Please enter your dog's weight in pounds: 90 Sadie's age in human years is 105 Would you like to calculate the age of another dog? (Y/N): Y Please enter the name of your dog: Rolf Please enter the actual age of your dog (1-16): 7 Please enter your dog's weight in pounds: -13 Error: weight must be greater than zero Please enter your dog's weight in pounds: 13 Rolf's age in human years is 44 Would you like to calculate the age of another dog? (Y/N): G Error: invalid choice Would you like to calculate the age of another dog? (Y/N): N Thank you for using the dog age calculator!
Step by Step Solution
3.48 Rating (148 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
