X
This website uses cookies to ensure you get the best experience on our website. By continuing to use this website, you consent to our use of these cookies.
News Archive

Engineering and Design with Computer Science

Students in computer science classes at Grier shared their recent projects, which included JavaScript drawings and 3D bobblehead sculptures. Grier’s computer programming courses offered in the IT Corridor are part of what earned Grier a top 20% ranking in Newsweek’s top 5,000 STEM schools of 2019 and a College Board AP® Computer Science Female Diversity Award for three years in a row.
In 3D Design class, Aurora K., Yueran S., Alyssa T., and Kiera Z. worked with software programs to design delightful 3D-printed bobblehead figurines. The 3D-printed bobblehead figurines are on display in the Computer & Robotics Lab. 

Soraya C., Evelyn D., Jiwon H., and Coco L. used JavaScript programming language in their Intro to Computer Science course to create digital artwork. Creating these simple-looking cartoon images required a healthy amount of actual coding to provide the computer with enough information to complete the drawing accurately. It typically took four printed pages of code to create one image! 

Here is Soraya C.’s code for an example:


/* This program draws an apple tree surrounded by flowers on a sunny day. */

// Variables for the grass
var GRASS_WIDTH = 400;
var GRASS_HEIGHT = 80;
var GRASS_TIP_HEIGHT = 30;

// Variables for the sun
var SUN_RADIUS = 70;
var SUNRAY_WIDTH = 7;

//Variables for the tree
var BUSH_RADIUS = 35;
var APPLE_RADIUS = 10;

//Variable for colors
var appleColor = new Color(255, 80, 80);
var flowerStemcolor = new Color(57, 172, 57);
var flowerPetals = new Color(77, 148, 255);

//Variables for the flowers
var FLOWER_STEM_WIDTH = 10;
var FLOWER_STEM_HEIGHT = 60;
var PETAL_RADIUS = 15;
var POLLEN_RADIUS = 8;


function start(){
var grass = new Rectangle (GRASS_WIDTH, GRASS_HEIGHT);
grass.setPosition(0, 400);
grass.setColor("#6B8E23");
add(grass);
var grassTip = new Rectangle (GRASS_WIDTH, GRASS_TIP_HEIGHT);
grassTip.setPosition(0, 400);
grassTip.setColor("#9ACD32");
add(grassTip);
var sun = new Circle (SUN_RADIUS);
sun.setPosition (30,30);
sun.setColor("#FFD700");
add(sun);
var rayOne = new Line (0, 0, 170, 0);
rayOne.setPosition (70, 0);
rayOne.setColor("#FFD700");
rayOne.setLineWidth (10);
add(rayOne);
var rayTwo = new Line (0, 0, 170, 30);
rayTwo.setPosition (20, 20);
rayTwo.setColor("#FFD700");
rayTwo.setLineWidth (SUNRAY_WIDTH);
add(rayTwo);
var rayThree = new Line (0, 0, 170, 60);
rayThree.setPosition (30, 40);
rayThree.setColor("#FFD700");
rayThree.setLineWidth (SUNRAY_WIDTH);
add(rayThree);
var rayFour = new Line (0, 0, 160, 90);
rayFour.setPosition (40, 60);
rayFour.setColor("#FFD700");
rayFour.setLineWidth (SUNRAY_WIDTH);
add(rayFour);
var rayFive = new Line (0, 0, 150, 120);
rayFive.setPosition (-40, 60);
rayFive.setColor("#FFD700");
rayFive.setLineWidth (SUNRAY_WIDTH);
add(rayFive);
var raySix = new Line (0, 0, 130, 160);
raySix.setPosition (-30, 63);
raySix.setColor("#FFD700");
raySix.setLineWidth (SUNRAY_WIDTH);
add(raySix);
var raySeven = new Line (10, 10, 80, 185);
raySeven.setPosition (-30, 63);
raySeven.setColor("#FFD700");
raySeven.setLineWidth (SUNRAY_WIDTH);
add(raySeven);
var trunk = new Rectangle (20, 150);
trunk.setPosition(246, 250);
trunk.setColor("#8B4513");
add(trunk);
var bushOne = new Circle (BUSH_RADIUS);
bushOne.setPosition (230,230);
bushOne.setColor("#99e600");
add(bushOne);
var bushTwo = new Circle (BUSH_RADIUS);
bushTwo.setPosition (258,180);
bushTwo.setColor("#99e600");
add(bushTwo);
var bushThree = new Circle (BUSH_RADIUS);
bushThree.setPosition (283,230);
bushThree.setColor("#99e600");
add(bushThree);
var bushFour = new Circle (BUSH_RADIUS);
bushFour.setPosition (210,180);
bushFour.setColor("#99e600");
add(bushFour);
var bushFive = new Circle (BUSH_RADIUS);
bushFive.setPosition (300,180);
bushFive.setColor("#99e600");
add(bushFive);
var bushSix = new Circle (BUSH_RADIUS);
bushSix.setPosition (258,145);
bushSix.setColor("#99e600");
add(bushSix);
var appleOne = new Circle (APPLE_RADIUS);
appleOne.setPosition (202,170);
appleOne.setColor(appleColor);
add(appleOne);
var appleTwo = new Circle (APPLE_RADIUS);
appleTwo.setPosition (260,140);
appleTwo.setColor(appleColor);
add(appleTwo);
var appleThree = new Circle (APPLE_RADIUS);
appleThree.setPosition (310,180);
appleThree.setColor(appleColor);
add(appleThree);
var appleFour = new Circle (APPLE_RADIUS);
appleFour.setPosition (250,195);
appleFour.setColor(appleColor);
add(appleFour);
var appleFive = new Circle (APPLE_RADIUS);
appleFive.setPosition (225,240);
appleFive.setColor(appleColor);
add(appleFive);
var appleSix = new Circle (APPLE_RADIUS);
appleSix.setPosition (290,230);
appleSix.setColor(appleColor);
add(appleSix);
var flowerStemone = new Rectangle (FLOWER_STEM_WIDTH, FLOWER_STEM_HEIGHT);
flowerStemone.setPosition (150,340);
flowerStemone.setColor(flowerStemcolor);
add(flowerStemone);
var petalOne = new Circle (PETAL_RADIUS);
petalOne.setPosition (140, 315);
petalOne.setColor(flowerPetals);
add(petalOne);
var petalTwo = new Circle (PETAL_RADIUS);
petalTwo.setPosition (155, 300);
petalTwo.setColor(flowerPetals);
add(petalTwo);
var petalThree = new Circle (PETAL_RADIUS);
petalThree.setPosition (170, 315);
petalThree.setColor(flowerPetals);
add(petalThree);
var petalFour = new Circle (PETAL_RADIUS);
petalFour.setPosition (155, 330);
petalFour.setColor(flowerPetals);
add(petalFour);
var pollenOne = new Circle (POLLEN_RADIUS);
pollenOne.setPosition (155, 315);
pollenOne.setColor("#FFD700");
add(pollenOne);
var flowerStemtwo = new Rectangle (FLOWER_STEM_WIDTH, FLOWER_STEM_HEIGHT);
flowerStemtwo.setPosition (45,340);
flowerStemtwo.setColor(flowerStemcolor);
add(flowerStemtwo);
var petalFive = new Circle (PETAL_RADIUS);
petalFive.setPosition (35, 315);
petalFive.setColor(flowerPetals);
add(petalFive);
var petalSix = new Circle (PETAL_RADIUS);
petalSix.setPosition (50, 300);
petalSix.setColor(flowerPetals);
add(petalSix);
var petalSeven = new Circle (PETAL_RADIUS);
petalSeven.setPosition (64, 315);
petalSeven.setColor(flowerPetals);
add(petalSeven);
var petalEight = new Circle (PETAL_RADIUS);
petalEight.setPosition (50, 330);
petalEight.setColor(flowerPetals);
add(petalEight);
var pollenTwo = new Circle (POLLEN_RADIUS);
pollenTwo.setPosition (50, 315);
pollenTwo.setColor("#FFD700");
add(pollenTwo);
var flowerStemthree = new Rectangle (FLOWER_STEM_WIDTH, FLOWER_STEM_HEIGHT);
flowerStemthree.setPosition (340,340);
flowerStemthree.setColor(flowerStemcolor);
add(flowerStemthree);
var petalNine = new Circle (PETAL_RADIUS);
petalNine.setPosition (330, 315);
petalNine.setColor(flowerPetals);
add(petalNine);
var petalTen = new Circle (PETAL_RADIUS);
petalTen.setPosition (345, 300);
petalTen.setColor(flowerPetals);
add(petalTen);
var petalEleven = new Circle (PETAL_RADIUS);
petalEleven.setPosition (360, 315);
petalEleven.setColor(flowerPetals);
add(petalEleven);
var petalTwelve = new Circle (PETAL_RADIUS);
petalTwelve.setPosition (345, 330);
petalTwelve.setColor(flowerPetals);
add(petalTwelve);
var pollenThree = new Circle (POLLEN_RADIUS);
pollenThree.setPosition (345, 315);
pollenThree.setColor("#FFD700");
add(pollenThree);

}

RW | RW
Back
©2021  Grier School. All Rights Reserved

Grier School

2522 Grier School Rd. | P.O. Box 308 Tyrone, PA 16686-0308
Phone: 814-684-3000 | Fax: 814-684-2177