MCS 390-61->72 Fall 1998
Homework 4 -- Virtual Pests

Due Date: Friday, Nov. 13 4:30 PM
Late Due Date: Tuesday, Nov 16 4:30 PM


This is the first part of a two-part assignment. The purpose of the assignment is for you to gain experience with writing conditional statements, using random numbers, and using functions. For this part, you will create an HTML FORM and describe how the form will behave under different circumstances. For the second part, you will add the described behavior to the form.


The most popular toy to hit the scene a few years ago was the "virtual pet" - an electronic toy that simulated pet behavior (displayed on a screen) and allowed its "owner" to respond to various types of behavior by performing actions (generally "pushing buttons"). Owners often find that these toys are more "virtual pests" than "virtual pets".

You can create your own virtual pest, using HTML and JavaScript. For this part of the assignment, you are to design the user interface, which will consist of an HTML FORM. You will also provide a written description of the various features of your pest and how the user interacts with it. You do not have to write any JavaScript code for this part of the assignment; that will be required for the second part.


Your virtual pest will contain at a minimum a form with the following elements:

You should create an HTML file containing the desired form elements. If you want to use an "HTML Editor" such as Claris Home Page to design your form, that is fine. You should note, however, that it will still be necessary to install JavaScript code in this file for the second part of the assignment.

You also need to plan your pest's behavior. This is a design exercise, not a coding exercise. You should design the behavior before you try to code it. For instance, you should use a table of the following form to describe your pest's behavior:



Possible values




text box


Woof woof





pat the dog

changes PetAction to "bite" if angry, and to "wag tail" if happy.


text box




WARNING: Don't try to describe behavior that is too complicated if you don't think you will be able to accomplish the desired behavior for the second part of the assignment.



You must do this work yourself. If you need assistance with this aspect of the assignment, see a consultant during consulting hours. You are encouraged to seek any necessary help from other persons regarding how to use your computer and accompanying software, in accordance with the stated course policy.