Question: Mini Project 3 2 : JavaScript Mini - Project Overview Time Estimate: 1 hour 1 . Write a JavaScript function to find the area of

Mini Project 32: JavaScript
Mini-Project Overview
Time Estimate: 1 hour
1.Write a JavaScript function to find the area of a triangle where the lengths of the three sides are 5,6,7.2.
2.Modify the script to round the area to the nearest tenth. Example: If the area is 23.579753340, then add code to round it to 23.6.
Project Submission Steps
For this exercise you will use an online Javascript editor and compiler called Playcode.
While there are several IDEs (integrated development environment) you can download and install to write code in Java, JavaScript, HTML, CSS, and other languages, using an online interface is much easier and faster, and there is nothing to install.
To get familiar with the playcode.io interface and better understand how you will use it, be sure to watch the companion video.
Note: Before writing the code to calculate the area of the triangle, be sure to write code to add the header. The header should say The area of a triangle is:.
1.Use Herons formula
for finding the area of a triangle (see below). Consider writing out your variables and functions on a scratch piece of paper before you start coding.
Herons formula
As you can see from the above formula, you will have five variables three for the sides, one for the semi-perimeter (s), and one for the final result (area).
Use the variable names side1, side2, and side3 to represent the three sides. Use the variable name s to represent the semi-perimeter. Finally, use the variable name area to represent the area.
HINT: Use the Math.sqrt function to calculate the area.
2. To round the area to the nearest tenth, create a new variable to represent the new rounded calculation, and use the toFixed() method. Use the variable name round to represent the final result.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!