Description:
Learn about Triangle. Check whether it makes a triangle by passing three sides of a triangle. Challenge your knowledge about triangle, by answering the questions in triangle quiz section. Calculate hypotenuse of a triangle by passing other two sides of triangle, similarly calculate area of a triangle by passing base and height of triangle. Click on the link below to learn about triangle.
Input:
A user has to enter input in number format only for sections
Is Triangle
,Hypotenuse of a triangle
andArea of a triangle
where input cannot be zero, negative number and floating-point number. Whereas inTriangle quiz
section a user has to select a radio button as input to answer questions. A user has to enter all inputs, if any missed then informed with message.
Output:
Output will be a simple message, displaying whether its a triangle giving three sides of traingle, what will be the hypotenuse of a triangle giving two sides, what will be the area of a traingle giving base & height and what you scored in the quiz.
Processing:
- Get inputs from user and match aginst input constraints, if not meet then inform the user with the desrired message.
- Click on button to get outcome on each page or section.
- In Is Triangle section or page a user has to enter three sides of the triangle and click on Is Triangle button, on each input(side) function check angle is called and checks for side not to be less then zero, not negative number, not be a floating-point number and other (if any). Then function solveAngle checks wether three sides makes a traingle or not by computing sum of three sides. After that user is informed with message wether sides form a traingle or not.
- In Hypotenuse of a triangle page, a user has to enter two sides (side a, side b) and then click on Calculate Hypotenuse button, on each input(side) function check side is called and checks for side not to be less then zero, not negative number, not be a floating-point number and other (if any). Then function calculate hypotenuse computes hypotenuse of two sides and updates user. Meanwhile if any error or input voilation occurs user is informed with message.
- In Area of triangle page, a user has to enter base(b) and height(h) of a triangle and to calculate area click on calculate area button. on each input function check side is called to check for side not to be less then zero, not negative number, not be a floating-point number and other (if any). Then function calulateArea calculates area of the triangle and updates the user. Meanwhile if any error or input voilation occurs user is informed with message.
- In Triangle quiz page a user has to select answer to question, and click on check answers button. For each correct a user will get +50 points and for incorrect -50 points. Function onFormSubmit and function checkAnswers check for input constraints and updates the user with message either score or error message.
Screenshots:
Link: