Question: Purpose To assess your ability to apply the knowledge and skills developed in weeks 1 through 4. Emphasis will be placed on the following learning
Purpose To assess your ability to apply the knowledge and skills developed in weeks 1 through 4. Emphasis will be placed on the following learning outcomes: 1. Create and display simple syntactically correct HTML documents. 2. Describe the execution a JavaScript program in a web browser. 3. Write and call functions that utilize parameters and return values. 4. Declare, define, and use variables in a script. 5. Correctly use the JavaScript conditional "if" statement.
Assignment
Your local school district wants a web page to analyze triangles based on the lengths of the three sides. You have been selected to create the HTML and JavaScript files needed to implement this analyzer. This application is to determine two things about each triangle once it determines that the inputs can form a triangle: Categorize by the number of sides with equal lengths o Equilateral triangle (all 3 sides are the same length) o Isosceles triangle (two sides are of the same length, the third is of a different length) o Scalene triangle (all 3 sides are of differing lengths) Categorize by largest angle o Right triangle (triangle contains a 90 degree angle) o Obtuse triangle (triangle contains an angle > 90 degrees) o Acute triangle (triangle only contains angles < 90 degrees) Categorizing by largest angle only using the lengths of the sides can be accomplished as follows:
Determine which of the three sides is the longest. We will call this s1 The other two sides we will call s2 and s3 Calculate the squares of each of the three sides. We will call these s1sq, s2sq and s3sq Compare s1sq to the sum of s2sq and s3sq If they equal then the triangle is a right triangle o This is the Pythagorean theorem If s1sq is bigger than the sum then it is an obtuse triangle Otherwise it is an acute triangle The first step is verifying that the inputs can form triangle. If the sum of the lengths of the two shorter sides is less than the longest sides length then those three sides cannot construct a triangle. Action Items/Programming Requirements The solution must use and deliver both an HTML and a JS file. The JS file must be referenced in the
tag of the HTML document using the
