Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python Task: In Exercise 1, you created a program that read a person's age and then displayed a message that included the person's age

image text in transcribeduse python

Task: In Exercise 1, you created a program that read a person's age and then displayed a message that included the person's age in dog years. In that exercise the age in dog years was computed by multiplying the age by 7, but some people believe that such a conversion to dog years is poor because most dogs reach adulthood by two years of age, and then age more slowly. They suggest that it is better if the first two human years each count as 10.5 dog years and each subsequent human year counts as only 4 dog years. Create a program that reads an age in human years and converts it to dog years using the better conversion described in the previous paragraph. Ensure that your program works correctly for both integer and real number ages. Your program should use a loop so that the user can keep on entering values to convert until a value less than 0 is entered Example input and output #1 (user input is shown in bold) Enter an age in human years: 1 That's equivalent to 10.5 dog years. Enter an age in human years: 2 That's equivalent to 21.0 dog years. Enter an age in human years: 0 That's equivalent to 0.0 dog years Enter an age in human years:-1 Example input and output #2 (user input is shown in bold) Enter an age in human years: 3 That's equivalent to 25.0 dog years. Enter an age in human years: 4.1 That's equivalent to 29.4 dog years Enter an age in human years:-3.14

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions