CS 176, Introduction to Computer Science II

Summer 2001 - Lab Test 1 Make-Up


An Australian jackrabbit population is exact if the population grows to equal exactly the maximum population after some number of breeding seasons. For example, the population starting at 15 is exact with respect to the maximum population 125:

15, 16, 31, 47, 78, 125
The population starting at 15 is not exact with respect to either of the maximum populations 77 or 32.

Prof. Fibonacci would like you to add the predicate exact to your jackrabbit population model. exact should take no arguments and return true if the population is exact and false if the population is not exact.

Use your new population model in a program that determines which of the following jackrabbit populations is exact: (522, 1045), (47, 1000), and (13, 100). For each of the populations, your program should print out the starting population, the maximum population, and either "exact" or "not exact"; for example

15 125 exact
15 32 not exact

Submit your test files using the command

/export/home/us/csfac/cs176-summer2001/bin/submit-lab-test your-files-here

where your-files-here are a list of the source files you've written for the test (your shell may let you abbreviate the command as ~csfac/cs176-summer2001/bin/submit-lab-test). You should get an e-mail response back in a few minutes. submit-lab-test is available from any linux system.

Make sure you submit something by the deadline. Unlike your programming assignments, you will not be able to submit you lab test after the 12:15 p.m. deadline.


This page last modified on 3 July 2001.