diff --git a/Documentation1.md b/Documentation1.md index 28f94fa..68fbc6e 100644 --- a/Documentation1.md +++ b/Documentation1.md @@ -1,19 +1,20 @@ # Name: +Force() ## Examples: -Insert examples here. +Force(10,5) +Returns 50 ## Description: -Insert description here +Calculates force by multilying mass and acceleration. ## Syntax: -Demonstrate syntax here +force(m,a) ##Parameters: -Name and describe parameters here +float m - mass +float a - acceleration ##Returns: -What type of data does it return? +float f - force -##Other notes: -Anything else? diff --git a/Documentation2.md b/Documentation2.md index 28f94fa..9e4f147 100644 --- a/Documentation2.md +++ b/Documentation2.md @@ -1,19 +1,21 @@ # Name: +slope() ## Examples: -Insert examples here. +slope(14,15,12,16) +Returns -.5 ## Description: -Insert description here +Calculates the slope of a line from two points on the line ## Syntax: -Demonstrate syntax here +slope(r1x,r1y,r2x,r2y) ##Parameters: -Name and describe parameters here +float r1x - x coordinate of first point +float r1y - y coordinate of first point +float r2x - x coordinate of second point +float r2y - y coordinate of second point ##Returns: -What type of data does it return? - -##Other notes: -Anything else? +float m - slope diff --git a/Documentation3.md b/Documentation3.md index 28f94fa..5e87231 100644 --- a/Documentation3.md +++ b/Documentation3.md @@ -1,19 +1,21 @@ # Name: +donut() ## Examples: -Insert examples here. +donut(width/2,height/2,200) +Draws a donut in the middle of the window. ## Description: -Insert description here +Draws a colored circle then a black circle 1/3 its size ## Syntax: -Demonstrate syntax here +donut(x,y,diam); ##Parameters: -Name and describe parameters here +x - x coordinate of donut +y - y coordinate of donut +diam - diameter of donut ##Returns: -What type of data does it return? +Displays donut -##Other notes: -Anything else? diff --git a/FunctionsChallenge/FunctionsChallenge.pde b/FunctionsChallenge/FunctionsChallenge.pde new file mode 100644 index 0000000..59dc1a2 --- /dev/null +++ b/FunctionsChallenge/FunctionsChallenge.pde @@ -0,0 +1,31 @@ +//physics +float force(float m, float a) { + float F = m*a; + return F; +} + +//math +float slope(float r1x, float r1y, float r2x, float r2y) { + float m = (r2y - r1y)/(r2x-r1x); + return m; +} + +//visual +void donut(float x, float y, float diam){ + fill(random(255),random(255),random(255)); + ellipse(x,y, diam, diam); + fill(0); + ellipse(x,y, diam/3,diam/3); +} + +void setup(){ + background(0); + size(800,600); + noStroke(); +} + +void draw() { + println(force(10, 5)); + println(slope(14, 15, 12, 16)); + donut(width/2,height/2,200); +} \ No newline at end of file