Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JavaScript Can someone help write a JavaScript file for the attachement below. 1

ID: 3883720 • Letter: J

Question

JavaScript

Can someone help write a JavaScript file for the attachement below.

1.The JavaScript file should contain at least three variables length1, length2 and length3 and assign values to them.

2. The html file has spaces for you to enter areas of specific shapes (via your JavaScript). All these areas need to be calculated from the three variables defined in item 1 above. Make sure your math is correct in calculating areas.Values need to be filled for ids: classname, triangle, circle, rectangle, and totalarea which display the total area of the three shapes.

Coding of the html file. You cannot change anything to the supplied html that I given below.

Shapes Hi! Class name Area of the Triangle: Area of the Circle: Area of the rectangle: Grand total area of all the shapes: 0 Submit Now

Explanation / Answer

//declare variables
var length = 3;
var breadth = 4;
var height = 5;
var radius = 6;

// calculate areas
var ra = length*breadth;
var ta = breadth*height/2;
var ca = Math.PI*radius*radius;

function updateValues(){
  
   // assign values to id's
   document.getElementById('classname').innerHTML = 'Chegg';
   document.getElementById('triangle').innerHTML = ta;
    document.getElementById('circle').innerHTML = ca;
    document.getElementById('rectangle').innerHTML = ra;
    document.getElementById('totalArea').innerHTML = ta+ca+ra;
}

//update values into html
document.getElementsByClassName('action').onclick = updateValues();

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote