Homework #11 (Due: Mon 16 Feb)

More practice with loops. In particular you should become comfor...
...oops and loops that use a sentinel value to mark the end of

For this assignment you will submit two separate programs, both of which are modifications of earlier assignments.

  1. First, modify the version of the ``dog years'' program you wrote for HW #5. In this assignment your program will ask the user a dog's age in human years (just as before) and will calculate the dog's ``dog year age'' (just as before), and you will provide sarcastic commentary about the dog's age (just as before). Instead of ending the program at this point, however, you will ask to user to enter the age of another dog (and then output it's ``dog year age'' and comment on the age), and so on. You will keep asking for the dog's age until the user enters a negative value for age. When a negative value for age is entered you should not calculate the dog years, etc., but rather output the message ``exiting dog years program'' and then ending the program.

  2. Second, modify the program you wrote for homework #9 so that your loop which happens a fixed number of times makes use of the "for" form of looping. NOTE: If your original assignment used a for loop then modify it to use a while loop instead!

    Good news! This will be the last of the dog years programs!!

Submit both programs by email to cscihomework@hsutx.edu with the a subject line of ``P1 HW #11''.


Quick Links