CSCI-1320 Homework 05: DogYears II

Instructor: Todd Dole

Purpose Statement

This assignment provides independent practice in writing a program in Java. Once you get the assignment complete you might spend some time "playing" with the program to see what other behavior you can elicit. REMEMBER: The statements you write are instructions for the computer. The computer will follow the instructions exactly as you say.

Instructions

To Get Started: Open your DogYears program from Homework 2. Change the class name to "DogYearsII" and then do File-->Save As to save it as DogYearsII.java

For this assignment you will modify the “dog age” program you wrote for homework #2. The program for this assignment will obtain a dog's age in human years and calculate the “dog years” equivalent as before. In addition to displaying the “dog years” age you will display commentary on the dog's age as follows:

if dog years age is 150 or greater say “Likely story!!”
if dog years age is 80 up to < 150 say “Hello Grand-dog!”
if dog years age is 40 up to < 80 say “Boring!”
if dog years age is 20 up to < 40 say “Get a job!”
if dog years age is under 20 say “Just a pup!”

Example Solution:

            Please Enter your Dog's Age in Human Years: 20
            Your dog is 140 dog years old.  Hello Grand-dog!
        

Upload your solution (your DogYearsII.java source code file) to the assignment in Canvas.

Bonus Challenge

Modify the Program to give the age for cats. Input the cat's age in human years, and then calculate the cat's age in cat years as follows:
A cat's first year is equivalent to 15 human years.
A cat's second year is equivalent to 24 human years.
Each additional year is equivalent to four human years.
Use a table similar to the one given above to describe the cat's age.

Example Solution:

            Please Enter your Cat's Age in Human Years: 20
            Your cat is 111 cat years old.  Hello Grand-cat!
        

If you complete this challenge, you may upload this to the Homework 5 as CatAge.java

Note on Bonus Challenges: These are good practice and you may submit them for feedback, but your grade will not be negatively affected if you do not do these.