Posted: Wed Oct 1

Due: Friday 10/3 10:00am

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

Part 0

Create a function based on the following flowchart


  flowchart TD;
    id0([fizzbuzz]) -- n --> id1[remainder n 15];
    id1 -- result0 --> id2{if\nresult0 = 0};
    id2 -- false --> id4(remainder n 3);
    id2 -- true --> id3([15]);

    id4 -- result1 --> id5{if\nresult1 = 0};
    id5 -- false --> id7(remainder n 5);
    id5 -- true --> id6([3])

    id7 -- result2 --> id8{if\nresult2 = 0};
    id8 -- false --> id9([-1]);
    id8 -- true --> id10([5]);

Part 1

Write flowcharts, contracts, and functions for the following:

  • 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
  • Square area
    • Takes an input for the side length of a square.
    • Outputs the area of that square.
  • Circle area
    • Takes an input for the radius of a circle
    • Outputs the area of that circle.
  • Shape Area
    • Takes in 2 inputs.
    • If the first input is even, output the area of a square using the second input as the side length.
    • If the first input is odd, output the area of a circle using the second input as the radius.