What I'm trying to do is make the Math.sqrt work. The program is running and all, but whatever I type the sides a,b,c to be it will give me the answer "-0.0 area units"
I tried not having this line: double area1 = s*(s-a)*(s-b)*(s-c);
and run it like: double area = Math.sqrt(s*(s-a)*(s-b)*(s-c));
Oh, I can explain. Keyboard.class is a file that my teacher gave me and told me to put in the same folder as the worked .java file. It's like a scanner, but my Keyboard didn't work earlier so I used scanner and now it works so I am only going to use it to loop my code because I don't know how to do it with scanner. Which means this part: igen = Keyboard.readChar();
And oh, herons formula is actually not there. I translated my entire code to english, it says heron there otherwise.
And the way I made it look fancy, it's just an extra thing I do for myself to make it look a bit more easier and readable. I know it wont make anything with the code if I add a little spaces
It's good practice to use a Short, Self-Contained, Compilable Example. "Short" you did. Self-contained, maybe you could put a comment above Keyboard to let us know what it is. "Compilable" it wasn't. A reader should be able to cut and paste your code and run it.
I may not be understanding you correctly, but if I am, formatting your code is not just being fancy, but it's an important part of making you code understandable to others and to you if you come back to it later. It's a really good habit to start now.
All things are lawful, but not all things are profitable.
Whip out those weird instruments of science and probe away! I think it's a tiny ad: