Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Mini Project 3 2 : JavaScript Mini - Project Overview Time Estimate: 1 hour 1 . Write a JavaScript function to find the area of
Mini Project : JavaScript
MiniProject Overview
Time Estimate: hour
Write a JavaScript function to find the area of a triangle where the lengths of the three sides are
Modify the script to round the area to the nearest tenth. Example: If the area is then add code to round it to
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:
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 semiperimeter s and one for the final result area
Use the variable names side side and side to represent the three sides. Use the variable name s to represent the semiperimeter. Finally, use the variable name area to represent the area.
HINT: Use the Math.sqrt function to calculate the area.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started