It is often said that one year for humans is equivalent to about seven years for...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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! 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!
Expert Answer:
Related Book For
Managerial Accounting A Focus on Ethical Decision Making
ISBN: 978-0324663853
5th edition
Authors: Steve Jackson, Roby Sawyers, Greg Jenkins
Posted Date:
Students also viewed these programming questions
-
Problema D Calgary tiene dos divisiones: una que maneja la materia prima en el proceso de produccin, y otra que maneja las terminaciones del producto final. Los costos variables en cada divisin son:...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
DAT, Inc., needs to develop an aggregate plan for its product line. Relevant data are The forecast for next year is Management prefers to keep a constant workforce and production level, absorbing...
-
What is the molecular formula for a cyclic alkyne with 14 carbons and two triple bonds?
-
In Problems 4764, find the exact values of the six trigonometric functions of the given angle. If any are not defined, say not defined. Do not use a calculator. 5 2
-
Which of the following statements is true? a. Concurrent update controls are designed to facilitate restoration of backups. b. Use of a VPN protects the confidentiality of information while it is...
-
Cost-plus target return on investment pricing. John Beck is the managing partner of a business that has just finished building a 60-room motel. Beck anticipates that he will rent these rooms for...
-
6) You are looking at setting up a C corporation to develop real estate. The company is looking at two alternatives. The first alternative produces a taxable income for the company of $18,000,...
-
John Fuji (birthdate June 6, 1981) received the following Form W-2 from his employer related to his job as a manager at a Washington apple-processing plant: Johns other income includes interest on a...
-
Describe 2 differences in Home Depot and Ace Hardware? Which store do you or your family prefer? Identify and briefly describe each of the four components of the Boston Consulting Group strategy....
-
What amounts are included in the asset cost of buying an imported machine from overseas (China to USA) for business purposes? Is general overhead included in this?
-
what are the merits and pitfalls of having a financial manager perform a dual role as a management accountant and financial manager in a private company?
-
Q1(d).You find there is a vacant piece of land next to the apartment building that's for sale for $4 million.Your business partner suggests you buy and hold the land for four years and sell it to a...
-
A hedge fund analyst is interested in the possible losses L for a certain stock. From historical data she has calculated the values of v1, v2, e1, e2 where: v=VaRa95 (L), v2 = VaRoss (L), e = ES0.95...
-
Joe transfers land with a FMV of $ 5 0 0 , 0 0 0 and basis of $ 1 0 0 , 0 0 0 for land owned by John. Land is subject to a mortgage of $ 1 0 0 , 0 0 0 ; John transfers $ 1 0 0 , 0 0 0 cash and land...
-
Compare and contrast organizational structure with organizational culture. Discuss the organizational structure in your current or past unit/workplace or clinical site (if not currently employed)....
-
In Problems, solve each system of equations. x + 2y + 3z = 5 y + 11z = 21 5y + 9z = 13
-
Candys Chocolate Shoppe had the following information available for the month of September: Required Calculate the cost of goods manufactured for themonth. Raw materials inventory Work in process...
-
Powers, Inc., has a project that requires an initial investment of $43,000 and has the following expected stream of cash flows: Year 1 ......$20,000 Year 2 ...... 30,000 Required Use Excel to...
-
The Cold Mountain Furnace Company is a retail store with locations across the eastern United States. The companys income statement for its first year of operations ended December 31, 2009 and its...
-
The Arcadia Company bid on a multiyear contract to construct the new hockey arena for the Phoenix Coyotes. The contract required that construction begin not later than January 1, 2015, and be...
-
Forms are provided in the Working Papers. Your instructor will guide you through the following examples. 1. Create a schedule that shows the payment of an annuity over a four-year period. The initial...
-
The Hilton Company sells inexpensive furniture on installment plans to customers that have poor credit. Many of the companys customers are sometimes not able to make the required payments, forcing...
Study smarter with the SolutionInn App