I'm honestly really stuck and have no idea where to even start with this. I've tried a few different ways of coding this but it comes back with so many errors I'm not sure if I'm even beginning to do it right.
The Question is below
Write an Application that reads the length of the sides of a triangle from the user. Compute the area using Heron's formula (below), in which s represents half of the perimeter of the triangle, and a, b, & c represent the lengths of the three sides. Print the area to three decimal places.
// Compute semi-perimeter and then area
s = (a + b + c) / 2.0d;
area = Math.Sqrt(s*(s-a) * (s - b) * (s - c));
This is for my visual C# class
Any kind of help would be appreciated!
Update What I have so far, not sure if any of it is even right
The only error I'm receiving at the moment is CS5001 (Program does not contain a static "main" method suitable for an entry point
Any help is appreciated even if it's saying all of this is wrong
namespace Heron {
class HeronsFormula {
public static void main(String[] args) {
Console.WriteLine("type tbh to find the area of triangle through heron's formula");
string typedvalue = Console.ReadLine();
if (typedvalue == "tbh") {
Console.WriteLine("Type the value of first side");
string side1 = Console.ReadLine();
Console.WriteLine("Type the value of second side");
string side2 = Console.ReadLine();
Console.WriteLine("type the value of third side");
string side3 = Console.ReadLine();
double fside = double.Parse(side1);
double sside = double.Parse(side2);
double thside = double.Parse(side3);
double s = (fside + sside + thside) / 2.0;
double har = Math.Sqrt(s * (s - fside) * (s - sside) * (s - thside));
Console.ReadLine();
}
}
}
}
Update 2