Copy link to clipboard
Copied
Need help with this because I can't find or solve this error. Heres the code. Program is used to calculate whether a triangle is a right angled triangle or not using mathematical calculations.
// This line makes the button, btnDetermine wait for a mouse click
// When the button is clicked, the determineIfRightTriangle function is called
btnDetermine.addEventListener(MouseEvent.CLICK, determineIfRightTriangle);
// These lines make the label, lblResponce wait for a mouse click
// When these components are clicked, the clearLabels function is called
lblResponce.addEventListener(MouseEvent.CLICK, clearLabels);
// This is the determineIfRightTriangle function
// e:MouseEvent is the click event experienced by the button
// void indicates that the function does not return a value
function determineIfRightTriangle(e:MouseEvent):void
{
// declare the variables
var lengthofside1:int;
var lengthofside2:int;
var lengthofside3:int;
var responce:String;
// get the length of sides from the user for the right angle triangle
lengthofside1 = int(txtinLengthOfSide1.text);
lengthofside2 = int(txtinLengthOfSide2.text);
lengthofside3 = int(txtinLengthOfSide3.text);
// calculate whether the sum of both lengthofside1 and lengthofside2 each squared equals lengthofside3 squared (which must be the greatest value)
if (Math.pow(lengthofside1, 2) + Math.pow(lengthofside2, 2)= Math.pow(lengthofside3, 2)
{
lblResponce.text = "These sides will make a Right Triangle, because X^2 + Y^2 = Z^2.";
}
else
{
lblResponce.text = "These sides will NOT make a Right Triangle, because X^2 + Y^2 ≠Z^2.";
}
}
// This is the clearLabels function
// e:MouseEvent is the click event experienced by the label
// void indicates that the function does not return a value
function clearLabels(e:MouseEvent):void
{
lblResponce.text = "";
}
1 Correct answer
I'm going to guess the one where he's missing a right paren before the left brace:
if (Math.pow(lengthofside1, 2) + Math.pow(lengthofside2, 2)= Math.pow(lengthofside3, 2)
{
Why is this even a question? The IDE tells you exactly what the error is, and exactly what line it's on. At this point I almost feel like we're being pranked.
Copy link to clipboard
Copied
what line number is triggering the error?
Copy link to clipboard
Copied
I'm going to guess the one where he's missing a right paren before the left brace:
if (Math.pow(lengthofside1, 2) + Math.pow(lengthofside2, 2)= Math.pow(lengthofside3, 2)
{
Why is this even a question? The IDE tells you exactly what the error is, and exactly what line it's on. At this point I almost feel like we're being pranked.
Copy link to clipboard
Copied
I just started a course for this so yea I really don't know half the stuff. Whatever I'm not gonna be using this program anyway.

