Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions ReturningValues/ReturningValues.pde
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
void setup(){
size(700,700); //size 700,700 and background black
background(0);
}
void draw(){
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){ //function to find hypotenuse using value of two different sides
float answer;
answer=sqrt(sq(a)+sq(b));
return(answer);
}

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
}

25 changes: 25 additions & 0 deletions VoidFunctions/VoidFunctions.pde
Original file line number Diff line number Diff line change
@@ -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);
}