Work 03: 9/14

posted Sep 14, 2018, 11:06 AM by JonAlf Dyrland-Weaver   [ updated Sep 16, 2018, 11:44 AM ]
Write the following racket functions. Save and submit a .rkt file with your definitions and test cases.
  • areaC
    • Has 1 parameter representing the diameter of a circle
    • Returns the area of that circle
    • Examples:
      • (areaC 20) ==> 314
      • (areaC 5) ==> 19.625
  • hypotenuse
    • Has 2 parameters representing the 2 non-hypotenuse legs of a right triangle.
    • Returns the length of the hypotenuse of the right triangle
      • Remember what your good friend Pythagoras taught you: a2 + b2 = c2
    • Examples:
      • (hypotenuse 3 4) ==> 5
      • (hypotenuse 11 60) ==> 61
  • perimFromArea
    • Has 1 parameter representing the area of a square.
    • Returns the perimeter of that square
    • Examples:
      • (perimFromArea 25) ==> 20
      • (perimFromArea 10) ==> 12.649110640673518
  • areaDonut
    • Consider a 2-dimensional donut, which is essentially a circle with a circular hole cut out of the middle.
    • Takes 2 parameters representing the diameter of the outer circle and the inner circle, respectively
    • Returns the area of that donut. 
    • Hint: you should already have written a function that finds the area of a circle
    • Examples:
      • (areaD 20 5) ==> 294.375
Submit this on the hw server under racket-1
Comments