Posted: Tue Sep 30

Due: Wednesday 10/1 10:00am

Submission name: work10.rkt AND work10.png (or other image file type)

This assignment has descriptions for three functions, for each, you need to make:

  • A function flowchart using variables.
  • A test case flowchart with real values.
  • A racket function (including contract and test cases) Submit your flowcharts as image files, and your Racket code as a Racket source file.

onesOrTens

  • Takes a single two digit integer parameter.
  • If that number is odd, return the ones digit of the number, if it is even, return the tens digit.

closerNumber

  • Takes 3 numbers as inputs.
  • Outputs whichever of the first 2 inputs is closer to the third input.
  • By closeness we are referring to the distance between 2 numbers on a number line.
    • The distance between 16 and 10 is 6
    • The distance between 7 and 10 is 3
    • 7 is closer to 10 than 16

triangleTest

  • Takes 3 positive integers as parameters.
  • Returns:
    • "right triangle" if the three parameters could be the sides of a right triangle.
    • "non-right triangle" if the three parameters could be the sides of a non-right triangle.
    • "not a triangle" if the three parameters could not be the sides of a triangle.
  • You can use functions from previous assignments in this function.
  • The triangle inequality states that:
    • For any triangle, the sum of the lengths of any two sides must be greater than or equal to the length of the remaining side.