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:
Answer rating: 100% (QA)
Step 1 First we import a Scanner class so that we can take input from the user import javautilScanner Then we create a DogAgeCalculator class public class DogAgeCalculator public static void mainStrin... View the full 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
-
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...
-
Suppose a firm pays total dividends of $500,000 out of net income of $2 million. What would the firm's payout ratio be?
-
Interview an entrepreneur. You can do the interview in person, by e-mail, or by phone. The person can be a local shop or restaurant owner, a hair salon owner, a pet groomer, a consultantany field is...
-
Briefly discuss the strengths and limitations associated with this approach and the specific design . Develop a hypothetical research scenario that would necessitate the use of the Action Research...
-
The comparative balance sheets for Strackman Lux Company as of December 31 are presented below. Additional information: 1. Operating expenses include depreciation expense of $40,000. 2. Land was sold...
-
Jessa owns a house and lot on 9th Avenue. She sells the house to the Hartley family, who wish to have a conveyance from her that says, to Harriet Hartley for life, remainder to her son, Alexander...
-
Futoshiki is a Sudoku-like Japanese logic puzzle that is very simple, but can be quite challenging. You are given an n x n grid, and must place the numbers 1, . . . n in the grid such that every row...
-
Let F be the collection of all distributions on R and z be a fixed real number. Define T(G) = | G(z - y)dG(y), GE F. Obtain the influence function or for T and show that or is continuous if and only...
-
Commercial Roofing Company purchases inventory of $64,500. The freight cost is $700. Its supplier uses the FOB destination method. Calculate the total cost of purchasing the inventory to Commercial...
-
Hat is a key feature in computing your FICO score? What is a key feature in computing your FICO score? Debt Your annual gross income How much money you have in savings?
-
A public traded company has a debt-equity ratio of 0.6 .Its cost of debt after tax is 7% and cost of equity is 11%. What the cost of equity for the company would be if its target capital structure...
-
True Steel's management has set up an internal risk management policy/system. One part of this system addresses the inputting of data into the software programs used in the accounting department....
-
Prior to the 1986 Tax Reform Act, taxpayers could average their in- come over multiple years when calculating each year's tax liability; this option was eliminated by the TRA. How does this violate...
-
What is the difference between funding a Global Business Strategy with a: Bond Issuance b. Stock Issuance c. Commercial Loan Which diminishes ownership and control? Which becomes an EXPENSE and thus...
-
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...
-
Cress Trust owns houses in Marion County, for whom Rainbow Realty Group, Inc., sells, rents, and manages. The same person serves as Rainbows president and Cresss corporate trustee. Cress offers four...
-
Genevieve and William Timmons began their tenancy of a ground-floor apartment at Cobblestone Square in September 2011. Kingsley-Johnston, Inc., is a property management company responsible for...
-
Linda Miller rented 35 acres of pastureland in Wabaunsee County, Kansas, from William Burnett for $1,000 per year. Miller and her husband used the land to grow and harvest brome grass for their...
Study smarter with the SolutionInn App