CSIS054: Perl ProgrammingHomework set 2
|
|||||||||||||||
1. Write a script that will compute the area of a geometric shape (triangle, square, etc). Ask the user how many sides the shape has, and how long a side is. Respond with the area of the shape. Be sure to document any limitations or assumptions that your script makes in the comments. | |||||||||||||||
2. Write a script that asks the user for the radius of a circle. Using the radius, compute and report back to the user:
|
|||||||||||||||
3. Write a script that asks the user these two questions:
and respond with the appropriate string from this table:
|
|||||||||||||||
4. Modify the script guess.pl so that it keeps track of how many guesses it takes the user to get the right number. Report this number back to the user. Be sure to congratulate them if it is 4 guesses or fewer, and admonish them if it is 8 guesses or more. | |||||||||||||||
5. Write a script, guess2.pl which plays the game from the opposite point of view. In other words, the user will choose a number (without saying what it is) and the computer will try to guess it. The user will tell the computer if it has guessed 'too high', 'too low', or correctly. |
Address of this page is http://hhh.gavilan.edu/phowell/csis054/02problems.html
Please contact Peter Howell at phowell@gavilan.edu for questions or comments.
Last updated January 10, 2010.