Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How Old is Your Dog in Human Years? Calculator In this assignment, you will write a program that calculates a dogs age in human years.

How Old is Your Dog in Human Years? Calculator

In this assignment, you will write a program that calculates a dogs age in human years. The program will prompt the user for an age in dog years and calculate that age in human years. Allow for int or float values, but check the users input to make sure it's valid -- it should be numeric and positive. Otherwise, let the user know their input is not valid.

You can use the following rules to approximately convert a medium-sized dogs age to human years:

  • For the first year, one dog year is equal to 15 human years
  • For the first 2 years, each dog year is equal to 12 human years
  • For the first 3 years, each dog year is equal to 9.3 human years
  • For the first 4 years, each dog year is equal to 8 human years
  • For the first 5 years, each dog year is equal to 7.2 human years
  • After that, each dog year is equal to 7 human years. (Note: This means the first 5 dog years are equal to 36 human years (5 * 7.2) and the remaining dog years are equal to 7 human years each.)

Print the result in the following format, substituting for dog_age and human_age: "The given dog age dog_age is human_age in human years." Round the result to 2 decimal places. Note: If there is a 0 in the hundredths place, you can drop it, e.g. 24.00 can be displayed as 24.0.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago