Calculate area of a triangle | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Calculate area of a triangle

it is an isosceles triangle. do not use scanner using menu base ( switch case)

20th Apr 2018, 1:53 PM
ashish
ashish - avatar
7 Answers
+ 2
What inputs are you given? Two sides? One angle, one side? Where do you get the input from, without using Scanner? Function call?
20th Apr 2018, 1:59 PM
Emma
+ 2
There are different ways of calculating the area. I've given two functions: https://code.sololearn.com/c9380BKxeo2e/?ref=app public static double area_given_two_sides ( double side_non_base, double side_base ) { double height = Math.sqrt ( (side_non_base * side_non_base) - Math.pow(side_base / 2.0, 2) ); return height * side_base / 2.0; } public static double area_angle_top_and_side_base ( double angle_top_degrees, double side_base ) { double angle_top = Math.toRadians(angle_top_degrees); return Math.tan(angle_top / 2.0) * (side_base * side_base) / 4.0; }
20th Apr 2018, 5:53 PM
Emma
+ 1
Martin you know what on my next test i have to make program using global. ... well i have a month to study
21st Apr 2018, 1:43 PM
ashish
ashish - avatar
0
under root a Square + b square by 4 ues int , double etc ... and System.out.peint...etc....call function
20th Apr 2018, 2:03 PM
ashish
ashish - avatar
0
Martin. ..well these are the same question that we get for our test. ...we are not allowed to us things which are not taught so... we have been told not to use ( Scanner, (we just completed function ),) if we use we won't get any marks
21st Apr 2018, 3:35 AM
ashish
ashish - avatar
0
no these are just for practice. ...Sir said he would not as these questions at all ... ( i am thinking that he would ask us to convert a big decimal number to binary. ..or visa versa)
21st Apr 2018, 4:03 AM
ashish
ashish - avatar
0
well Martin can you explain why global is used
21st Apr 2018, 4:04 AM
ashish
ashish - avatar