This example is taken from Software Engineering course notes by Prof. W. B. Joerg.




Read the example as follows:

  1. If Contribution < 25 and Age-Class not = Student or Retiree,
    set Membership to Non-Member, Premium to None and Publication to None.
  2. If Contribution < 25 and Age-Class = Student or Retiree,
    set Membership to Non-Member, Premium to None and Publication to None.
  3. If 25 <= Contribution < 40 and Age-Class not = Student or Retiree,
    set Membership to Non-Member, Premium to None and Publication to None.
  4. If 25 <= Contribution < 40 and Age-Class = Student or Retiree,
    set Membership to Member, Premium to None and Publication to Publish.
  5. If 40 <= Contribution < 60 and Age-Class not = Student or Retiree,
    set Membership to Member, Premium to Mug and Publication to Publish.
  6. If 40 <= Contribution < 60 and Age-Class = Student or Retiree,
    set Membership to Member, Premium to Mug and Publication to Publish.
  7. If 60 <= Contribution < 120 and Age-Class not = Student or Retiree,
    set Membership to MMember, Premium to Umbrella and Publication to Publish.
  8. If 60 <= Contribution < 120 and Age-Class = Student or Retiree,
    set Membership to MMember, Premium to Umbrella and Publication to Publish.
  9. If 120 <= Contribution and Age-Class = not Student or Retiree,
    set Membership to Studio-Club, Premium to Big-Bird and Publication to Publish.
  10. If 120 <= Contribution and Age-Class = Student or Retiree,
    set Membership to Studio-Club, Premium to Big-Bird and Publication to Publish.
Since Age-Class is usually irrelevant, you will find that Cope generates code that only tests it when necessary.

This page has been accessed access counter times since 16th June 1999.