From 7c029771e40b0d4cee88f9a7eacd6efd7a0277f3 Mon Sep 17 00:00:00 2001 From: mmehta21 Date: Thu, 3 Dec 2015 09:26:57 -0500 Subject: [PATCH 1/3] 1st assignments --- VoidFunctions/VoidFunctions.pde | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/VoidFunctions/VoidFunctions.pde b/VoidFunctions/VoidFunctions.pde index 8b13789..3fcb2dd 100644 --- a/VoidFunctions/VoidFunctions.pde +++ b/VoidFunctions/VoidFunctions.pde @@ -1 +1,26 @@ +void setup(){ + size(600,600); //size + background(0); //black background +} +void draw(){ + bSquare(); //draw function bSqaure + cCircle(200,240,190); //draw function cCircle + myFunction(100,150,200); //draw myFunction +} + +void bSquare(){ //function bSquare has a blue fill and square in middle of plot + fill(0,0,255); + rect((width/2)-50,(width/2)-50,100,100); +} + +void cCircle(float x,float y,float z){ //function cCircle that allows you to change fill and draws cirlce size 30 + fill(x,y,z); + float sz=30; + ellipse(mouseX,mouseY,sz,sz); +} + +void myFunction(int x,int y, int z){ //function that draws triangle and lets yo change the border + stroke(x,y,z); + triangle(200,200,250,400, 500,600); +} \ No newline at end of file From ce99006300b43ba350705053098bdedca068da94 Mon Sep 17 00:00:00 2001 From: mmehta21 Date: Wed, 9 Dec 2015 08:04:24 -0500 Subject: [PATCH 2/3] simple --- ReturningValues/ReturningValues.pde | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ReturningValues/ReturningValues.pde b/ReturningValues/ReturningValues.pde index 8b13789..d84a09f 100644 --- a/ReturningValues/ReturningValues.pde +++ b/ReturningValues/ReturningValues.pde @@ -1 +1,13 @@ +void setup(){ + size(700,700); + background(0); +} +void draw(){ + println(hypotenuseOfRightTriangle(1,sqrt(3))); +} +float hypotenuseOfRightTriangle(float a, float b){ + float answer; + answer=sqrt(sq(a)+sq(b)); + return(answer); +} \ No newline at end of file From 2a74ecae4ca4aee843a34b4bd209a7c2aea4432c Mon Sep 17 00:00:00 2001 From: mmehta21 Date: Wed, 9 Dec 2015 09:04:58 -0500 Subject: [PATCH 3/3] Finished 3 functions --- ReturningValues/ReturningValues.pde | 33 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/ReturningValues/ReturningValues.pde b/ReturningValues/ReturningValues.pde index d84a09f..c247a2d 100644 --- a/ReturningValues/ReturningValues.pde +++ b/ReturningValues/ReturningValues.pde @@ -1,13 +1,36 @@ void setup(){ - size(700,700); - background(0); + size(700,700); //size 700,700 and background black + background(0); } void draw(){ - println(hypotenuseOfRightTriangle(1,sqrt(3))); + bluePattern(50,50); //draw blue patern starting at locatio 50,50 + String vf="The Velocity Final is...."; //create string vf which equals ... + String finalSide="The final side's value is..."; //create string finalSide which equals ... + println(vf); //print "The velocity final is..." + println(velocityFinal(3,4,5)); //print the returned value from the function using value 3,4, and 5 + println(finalSide); //print "The final side's value..." + println(hypotenuseOfRightTriangle(3,4)); //print returned value from the function using the value 3 and 4 } -float hypotenuseOfRightTriangle(float a, float b){ +float hypotenuseOfRightTriangle(float a, float b){ //function to find hypotenuse using value of two different sides float answer; answer=sqrt(sq(a)+sq(b)); return(answer); -} \ No newline at end of file +} + +float velocityFinal(float vo, float a, float t){ //function to find velocity final using initial velocity, acceleration, and time + float vf; + vf=vo+(a*t); + return(vf); +} + +void bluePattern(float x, float y){ + fill(0,0,255); //set fill to blue + ellipse(x,y,50,50); //draw ellipse at x,y and size 50x50 + rect(x,y,200,200); //draw ellipse at x,y and size 200x200 + ellipse(x+200,y+200,50,50); //draw ellipse at bottom right of first square + rect(x+200,y+200,200,200); //draw rectangle with top left corner at the center of 2nd ellipse + ellipse(x+400,y+400,50,50); //draw ellipse at bottom right of the second square + rect(x+400,y+400,200,200); //draw rectangle with top left corner at the center of 3rd ellipse +} + \ No newline at end of file