Question
im using java script and i want to use function basedistance to call the function objectheight. what should i change in the code?
scripts/HeightEstimate.js (skeleton) Navigate Debug Help ها 1 /Feature 5: 2 1/ Camreal and Angleb will be considered as two v
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

Please find below :

Calling one function from another :

function BaseDistance(CameraH,Angleb){
distance=CameraH+Math.tan(Angleb*Math.PI/180);
//Calling the Objectheight function by passing the parameters distance and alpha
finalDistance = Objectheight(distance,210);
return finalDistance;//returning the finalDistance
}
function Objectheight(baseDistance, alpha){
let heightTotal,height;
alpha = alpha-90;
alert("Alpha is"+alpha);
Height = baseDistance*Math.tan(alpha);
alert("Height is"+Height);
heightTotal = Height+baseDistance;
if(heightTotal<0){
return "degree is not valid therefore negative";
}
else{
return heightTotal;
}
}
alert("The base distance is "+BaseDistance(1,30));

Thank You

Add a comment
Know the answer?
Add Answer to:
im using java script and i want to use function basedistance to call the function objectheight....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • how to make my code of python work probely my q is how to write a...

    how to make my code of python work probely my q is how to write a code to find the average actual water level, average error by using python and my program should be flexible where user can select the column no. If you can see in the main program, it asked which column to know the maximum or average, the column number is passed to the function. The function should look which column to do. #THIS PROGRAMMING IS ABLE...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT