7.2.5 Height In Meters

Question: 5.1.4: Square

Answer: function start(){

square(5);

}

function square(x){

var squareX = x * x;

println(squareX);

}

Question: 5.1.5: Triple

Answer: function start(){

triple(5);

}

function triple(x){

var tripleX = 3 * x;

println(tripleX);

}

Question: 5.2.4: Area of Triangle

Answer: function start(){

triangleArea(5, 4);

}

function triangleArea(BASE, HEIGHT){

var result = 1/2

HEIGHT;

println(result);

}

Question: 5.2.5: Height in Meters

Answer: var INCHESTOCM = 2.54;

var CMTOMETERS = 100;

var FEETTOINCHES = 12;

function start(){

convertHeightToMeters(6,4);

}

function convertHeightToMeters(x, y){

var inches = ((x * FEETTOINCHES) + y);

var cm = (inches * INCHESTOCM);

var meters = (cm / CMTOMETERS);

println(meters);

}

Question: 5.3.4: Horizontal Lines

Answer: function start(){

horizontalLine(100, 200);

horizontalLine(200, 100);

horizontalLine(300, 20);

}

function horizontalLine(y,length){

var line = new Line(0,y,length,y);

line.setLineWidth(1);

add(line);

}

Donation Page

Support Our Work

Do you appreciate the value this website provides? If so, please consider donating to help keep it running. Your donation will go a long way in helping us continue to provide the same quality of content and services. Every bit helps, and your support is greatly appreciated. Thank you for your generosity.