CISC108 Lecture 3: Beginner Design Recipe

45 views4 pages

Document Summary

B e g i n n e r " s d e s i g n r e c i p e: [data de nition] read the problem. Number, you may still need an interpretation, for example temperature is a. ;;!a!posnum!is!any!positive!number: [signature/purpose/header] write the contract and purpose statement. Write a function that computes the area of a rectangle, given the width and height. Then write the function header, using the information from the contract. Use meaningful names for any input parameters that are consumed. Stub value of the correct type (your tests may fail but some errors will be detected). (define! (area!width!height) !0): [examples] make up examples of inputs. At the beginning, you basically only have your parameters. If any parameter is an enumeration or a set of intervals, then you likely will use a conditional in the body. Consider what the question should be for each clause, and what the answer should be, separately.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents