วันพุธที่ 17 ธันวาคม พ.ศ. 2557

ส่วนที่แก้ไขต่างๆจาก bitbucket (3)

 void varPage1() {
-  int xVar1=100;
-  int xVar2=150;
-  int xVar3=100;
-  textSize(25);
-  fill(#3490D8);
-  rect(350, 65, 190, 60);
-  fill(255);
-  text("VARIABLE", 390, 100);
-//  if (xVar1<=100) {
-//    xVar1+=1.7;
-//  }
-//  else {
-//    xVar1=101;
-//  }
-  textSize(17);
-  text("'Variable' is a storage location paired with an associated symbolic name ,", xVar1, 180);
-  text("which contains some known or unknown quantity or information referred to as a value.", xVar1-50, 220);
-  ///////////////////////////////////////////////////////////////////////////////////////////////////
-//  if (xVar2>=150) {
-//    xVar2-=1.7;
-//  }
-//  else {
-//    xVar2=149;
-//  }
-  textSize(20);
-  fill(#F06A7A);
-  text("kind of variable", xVar2-50, 260);
-  stroke(#F06A7A);
-  line(xVar2-50, 265, xVar2+100, 265);
-  textSize(17);
-  text("- Byte : Contain the integer from -128 until to 127 and storage 1 byte. ", xVar2, 300);
-  text("- Int : Contain the integer data type and storage 4 bytes. ", xVar2, 340);
-  text("- float : Contain the decimal data type and storage 4 bytes. ", xVar2, 380);
-  text("- Char : Contain the character data type and storage 2 bytes. ", xVar2, 420);
-  ///////////////////////////////////////////////////////////////////////////////
-//  if (xVar3<=100) {
-//    xVar3+=1.7;
-//  }
-//  else {
-//    xVar3=101;
-//  }
-  textSize(20);
-  fill(#12C43C);
-  text("Assignment Operator", xVar3, 460);
-  stroke(#12C43C);
-  line(xVar3, 465, xVar3+205, 465);
-  textSize(17);
-  text("An assignment operator is the operator used to assign a new value to a variable, ", xVar3+50, 500);
-  text("example the regularly usage.", xVar3, 540);
-  text("+ (plus)", xVar3-50, 580);
-  text("- (minus)", xVar3-50, 620);
-  text("* (multiply)", xVar3+80, 580);
-  text("/ (divide)", xVar3+80, 620);
-  text("> (over)", xVar3+210, 580);
-  text("< (less than)", xVar3+210, 620);
-  text("= (eqaual)", xVar3+350, 580);
-  text("!= (not equal)", xVar3+350, 620);
-  text("&& (and)", xVar3+490, 620);
-  text("|| (or)", xVar3+490, 580);
-  text("% (modulation)", xVar3+610, 580);
-  ///////////////////////////////
-  noFill();
+int xVar1=100;
+int xVar2=150;
+int xVar3=100;
+textSize(25);
+fill(‪#‎3490D8‬);
+rect(350, 65, 190, 60);
+fill(255);
+text("VARIABLE", 390, 100);
+// if (xVar1<=100) {
+// xVar1+=1.7;
+// }
+// else {
+// xVar1=101;
+// }
+textSize(17);
+text("'Variable' is a storage location paired with an associated symbolic name ,", xVar1, 180);
+text("which contains some known or unknown quantity or information referred to as a value.", xVar1-50, 220);
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// if (xVar2>=150) {
+// xVar2-=1.7;
+// }
+// else {
+// xVar2=149;
+// }
+textSize(20);
+fill(‪#‎F06A7A‬);
+text("kind of variable", xVar2-50, 260);
+stroke(#F06A7A);
+line(xVar2-50, 265, xVar2+100, 265);
+textSize(17);
+text("- Byte : Contain the integer from -128 until to 127 and storage 1 byte. ", xVar2, 300);
+text("- Int : Contain the integer data type and storage 4 bytes. ", xVar2, 340);
+text("- float : Contain the decimal data type and storage 4 bytes. ", xVar2, 380);
+text("- Char : Contain the character data type and storage 2 bytes. ", xVar2, 420);
+///////////////////////////////////////////////////////////////////////////////
+// if (xVar3<=100) {
+// xVar3+=1.7;
+// }
+// else {
+// xVar3=101;
+// }
+textSize(20);
+fill(‪#‎12C43C‬);
+text("Assignment Operator", xVar3, 460);
+stroke(#12C43C);
+line(xVar3, 465, xVar3+205, 465);
+textSize(17);
+text("An assignment operator is the operator used to assign a new value to a variable, ", xVar3+50, 500);
+text("example the regularly usage.", xVar3, 540);
+text("+ (plus)", xVar3-50, 580);
+text("- (minus)", xVar3-50, 620);
+text("* (multiply)", xVar3+80, 580);
+text("/ (divide)", xVar3+80, 620);
+text("> (over)", xVar3+210, 580);
+text("< (less than)", xVar3+210, 620);
+text("= (eqaual)", xVar3+350, 580);
+text("!= (not equal)", xVar3+350, 620);
+text("&& (and)", xVar3+490, 620);
+text("|| (or)", xVar3+490, 580);
+text("% (modulation)", xVar3+610, 580);
+///////////////////////////////
+noFill();
 }
 void varPage2() {
-  int xVar4=100;
-  int xVar5=150;
-  int xVar6=100;
-  textSize(20);
-  fill(#E0E802);
-  text("A variable step", 50, 80);
-  stroke(#E0E802);
-  line(50, 85, 195, 85);
-  fill(#F9BBFA);
-//  if (xVar4<=100) {
-//    xVar4+=1.7;
-//  }
-//  else {
-//    xVar4=101;
-//  }
-  textSize(17);
-  text("1. Variable declaration : write the type of the variable and then write the variable name.", xVar4, 130);
-  text("example ---> int a; [declare the variable 'a' in an integer data type]", xVar4+75, 170);
-  text("The Scope of variable.", xVar4+25, 210);
-  text("- Local Varible : declaring in function.", xVar4+50, 250);
-  text("- Glocal Varible : declaring out of function.", xVar4+50, 290);
-  /////////////////////////////////////////////////////////////
-//  if (xVar5>=150) {
-//    xVar5-=1.7;
-//  }
-//  else {
-//    xVar5=149;
-//  }
-  fill(#AEDEF2);
-  text("2. Assign the variable : Specify a value to a variable,", xVar5-50, 330); 
-  text("The value on the right hand side assign the variable", xVar5-30, 370);
-  text("example ---> int a=10; [assign the variable 'a' has an integer value is 10]", xVar5+25, 410);
-  ///////////////////////////////////////////////////////////////////////////////////////////
-//  if (xVar6<=100) {
-//    xVar6+=1.7;
-//  }
-//  else {
-//    xVar6=101;
-//  }
-  fill(#FA8238);
-  text("3. To call the variable : call the variable with 2 type", xVar6, 450); 
-  text("- User defined variable : call the variable that user make the variable by step 1 and 2.", xVar6+20, 490);
-  text("example ---> line(a,30,a+50,30);", xVar6+75, 530);
-  text("- System variable : call the variable that already to use in processing program.", xVar6+20, 570);
-  text("example ---> mouseX , mouseY , etc.", xVar6+75, 610);
-  noFill();
+int xVar4=100;
+int xVar5=150;
+int xVar6=100;
+textSize(20);
+fill(‪#‎E0E802‬);
+text("A variable step", 50, 80);
+stroke(#E0E802);
+line(50, 85, 195, 85);
+fill(‪#‎F9BBFA‬);
+// if (xVar4<=100) {
+// xVar4+=1.7;
+// }
+// else {
+// xVar4=101;
+// }
+textSize(17);
+text("1. Variable declaration : write the type of the variable and then write the variable name.", xVar4, 130);
+text("example ---> int a; [declare the variable 'a' in an integer data type]", xVar4+75, 170);
+text("The Scope of variable.", xVar4+25, 210);
+text("- Local Varible : declaring in function.", xVar4+50, 250);
+text("- Glocal Varible : declaring out of function.", xVar4+50, 290);
+/////////////////////////////////////////////////////////////
+// if (xVar5>=150) {
+// xVar5-=1.7;
+// }
+// else {
+// xVar5=149;
+// }
+fill(‪#‎AEDEF2‬);
+text("2. Assign the variable : Specify a value to a variable,", xVar5-50, 330);
+text("The value on the right hand side assign the variable", xVar5-30, 370);
+text("example ---> int a=10; [assign the variable 'a' has an integer value is 10]", xVar5+25, 410);
+///////////////////////////////////////////////////////////////////////////////////////////
+// if (xVar6<=100) {
+// xVar6+=1.7;
+// }
+// else {
+// xVar6=101;
+// }
+fill(‪#‎FA8238‬);
+text("3. To call the variable : call the variable with 2 type", xVar6, 450);
+text("- User defined variable : call the variable that user make the variable by step 1 and 2.", xVar6+20, 490);
+text("example ---> line(a,30,a+50,30);", xVar6+75, 530);
+text("- System variable : call the variable that already to use in processing program.", xVar6+20, 570);
+text("example ---> mouseX , mouseY , etc.", xVar6+75, 610);
+noFill();
 }
 void VarExplanation() {
-  textSize(20);
-  text("Explanation of Variable steps ", 310, 80);
-  if (y_var2<=190) {
-    y_var2+=1.5;
-    fill(255);
-    ellipse(420, y_var2, 50, 50);
-    fill(0);
-    text("int", 410, y_var2);
-    textSize(20);
-    text("A", 460, 200);
-  }
-  else {
-    fill(0);
-    ellipse(380, 300, 100, 100);
-    fill(255);
-    text("int A", 360, 300);
-    if (x_var2>=540) {
-      x_var2-=2;
-    }  
-    else {
-      text("=", 470, 305);
-      text("The value on the right hand side assign the variable.", 210, 450);
-    }
-    ellipse(x_var2, 300, 50, 50);
-    fill(0);
-    text("50", x_var2-10, 305);
-    fill(255);
-  }
+textSize(20);
+text("Explanation of Variable steps ", 310, 80);
+if (y_var2<=190) {
+y_var2+=1.5;
+fill(255);
+ellipse(420, y_var2, 50, 50);
+fill(0);
+text("int", 410, y_var2);
+textSize(20);
+text("A", 460, 200);
+} else {
+fill(0);
+ellipse(380, 300, 100, 100);
+fill(255);
+text("int A", 360, 300);
+if (x_var2>=540) {
+x_var2-=2;
+} else {
+text("=", 470, 305);
+text("The value on the right hand side assign the variable.", 210, 450);
 }
-void mousePressed() {
-  ///////////////var//////////////////////////////////////////
-  if (change_var<2) {
-    change_var++;
-  }
-  ////////////////function////////////////////////////////////
-  if (mousePressed&&mouseX>=posX2+50&&mouseX<= width&&mouseY >= posY2-230&&mouseY <= posY2-100) {
-    countPage=3;
-  } else if (countPage==3) {
-    SwitchFunction++;
-  }
-  ////////////////array////////////////////////////////////
-  else if ((mousePressed&&mouseX>=150&&mouseX<= turtleX+100)&&(mouseY >= turtleY-90&&mouseY <= height)) {
-    countPage=4;
-  } else if (countPage==4) {
-    SwitchArray++;
-  } else if (mousePressed&&mouseX>=20&&mouseX<=200&&mouseY>=20&&mouseY<=350) {
-    countPage=5;
-  } else if (change_con<3) {
-    change_con++;
-  }
+ellipse(x_var2, 300, 50, 50);
+fill(0);
+text("50", x_var2-10, 305);
+fill(255);
 }
+}
+
+void teachIfelse() {
+int xCon1=100;
+int xCon2=150;
+int xCon3=100;
+fill(255);
+textSize(20);
+text("If-else", 430, 80);
+stroke(255);
+// if (xCon1<=100) {
+// xCon1+=1.7;
+// }
+// else {
+// xCon1=101;
+// }
+line(430, 85, 495, 85);
+fill(‪#‎DED636‬);
+textSize(17);
+text("If : Allows the program to make a decision about which code to execute.", xCon1+50, 120);
+text("If the test evaluates to true, the statements enclosed within the block are executed", xCon1, 160);
+text("and if the test evaluates to false the statements are not executed.", xCon1, 200);
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// if (xCon2>=150) {
+// xCon2-=1.7;
+// }
+// else {
+// xCon2=149;
+// }
+fill(‪#‎8AC1F0‬);
+text("else : Extends the if structure allowing the program to choose between", xCon2, 240);
+text(" two or more block of code. It specifies a block of code to execute", xCon2-50, 280);
+text("when the expression in if is false.", xCon2-50, 320);
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// if (xCon3<=100) {
+// xCon3+=1.7;
+// }
+// else {
+// xCon3=101;
+// // ButtonChangePage(820, 550, "Press Key 1");
+// }
+fill(255);
+text("* example *", xCon3+100, 360);
+text("int x=30;", xCon3+300, 400);
+text("if( x < 20 ){", xCon3+300, 440);
+text("println(100);", xCon3+330, 480);
+text("}else{", xCon3+300, 520);
+text("println(200);", xCon3+330, 560);
+text("}", xCon3+330, 600);
+text("}", xCon3+300, 640);
+}
+void teachLoop() {
+int yCon1=120;
+int yCon2=360;
+// if (yCon1<=120) {
+// yCon1+=1.7;
+// }
+// else {
+// yCon1=121;
+// }
+fill(255);
+textSize(20);
+text("Loop", 430, 80);
+stroke(255);
+line(430, 85, 480, 85);
+textSize(15);
+fill(‪#‎B2CCFF‬);
+text("For Loop : A basic for structure has three parts: init, test, and update.", 150, yCon1);

+text("Each part must be separated by a semicolon (;). The loop continues until the 
test evaluates to false,", 100, yCon1+40);
+text("When a for structure is executed.", 100, yCon1+80);
+fill(255);
+text("* example *", 200, yCon1+120);
+text("for (int i = 0; i < 80; i = i+5) {", 340, yCon1+120);
+text("line(30, i, 80, i);", 380, yCon1+160);
+text("}", 340, yCon1+200);
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// if (yCon2>=360) {
+// yCon2-=1.7;
+// }
+// else {
+// yCon2=359;
+// // ButtonChangePage(820, 550, "Press Key 2");
+// }
+fill(‪#‎F793E2‬);
+text("While Loop : executes a series of statements continuously while the expression is true.", 150, yCon2);
+text("The expression must be updated during the repetitions or the program will never break out of while.", 100, yCon2+40);
+fill(255);
+text("* example *", 200, yCon2+80);
+text("int i = 0;", 340, yCon2+80);
+text("while (i < 80) {", 340, yCon2+120);
+text("line(30, i, 80, i);", 380, yCon2+160);
+text("i = i + 5;", 380, yCon2+200);
+text("}", 340, yCon2+240);
+}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น