# Triangle in java

Hello guys, I tried to solve this question Input the length of three sides of a triangle, calculate the area of the triangle, and output the results. It is suggested that if the three sides of triangle are a, b and c respectively, the formula for calculating the triangle area is as follows: S=(a+b+c)/2 Area = sqr s* (s-a)(s-b)(s-c) I wrote the code but im facing some problems with the BufferReader i dont know if i have to do a class and what to fill in the class, and IOExpetion facing the same issue, so please if you can help I’ll appreciate This is the code https://code.sololearn.com/c6RWX5Aa8uD9/?ref=app

4/27/2021 2:38:26 PM

Any5 Answers

New AnswerYou line 34 has got a typo(formula mistake) replace it with - return(Math.sqrt(s*(s-a) * (s-b) * (s-c))); And the rest looks find. congrats.

Your BufferedReader is missing the letter 'd' (line 43) HeeSoKa Spelling wrong line 58 of "IOException" and add this- import java.io.IOException;

These are all needed to be imported. You don't need anything else. import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; There are lots of typo like IOException, BufferedReader, readLine().... *Typo formula of area. You wrote (c-a) where it should be (s-a).* Basically, your program has lots of incorrect spelling or typo. Not much of a problem.

I would recommend just using scanner class. I do not know what the question is. But if you just have to take in lengths and calculate area (you could use 1/2 * base * height), then Scanner is good to go.