Due: Tuesday 09/24 10:00am

Submission name: work08.rkt

Write contracts and the functions for the following:

Use define and lambda to write your functions. Include test cases with descriptive output. You will have to create your own test cases.

  • isEven
    • Has 1 parameter that is a number.
    • Returns
      • true if the parameter is even
      • false in all other cases
  • isMultiple
    • Has 2 number parameters (let’s call them n and m)
    • Returns:
      • true if n is a multiple of m
      • false in all other cases
  • twoDigits
    • Has 1 positive integer parameter
    • Returns:
      • true if the parameter is a 2 digit number
      • false in all other cases
  • xDigits
    • Has 2 positive integer parameters (lets call them n and x)
    • Returns:
      • true n is an x digit number.
      • false in all other cases

Skills For Test I

Skill Minimal Competency Developing Competency Competency Mastery
2. Using Functions Can explain the concept of a function. Uses a single function to produce a desired outcome. Combines multiple functions to produce a desired outcome. Appropriately uses functions that return and do not return values, combining them to produce a desired outcome.
3. Writing functions/procedures. Can write the contract for a function. Can write simple functions given a contract. Can write complex functions given a contract and can write contracts for functions given a specified task. Can write contracts for complex functions, implement those functions and create effective test cases for them.
5. Working with Boolean Values Understands the purpose of boolean values. Demonstrates the appropriate use of comparison operators. Demonstrates the appropriate use of comparison and boolean operators. Writes functions that take in boolean values and/or return boolean values.
22. Using Variables Recognizes the difference between variables and literals Demonstrates ability to understand code which uses variables Correctly uses variables in programming Correctly uses the appropriate types of variables for different programming algorithms
23. How Functions Operate Knows the difference between calling and defining a function Can correctly define and call functions Understands, in general terms, the difference between what happens in the computer when you define or when you call a function. Can correctly explain what happens in the computer when a function is called and when a function is defined, using the correct vocabulary (ex, parameters/arguments).