Hello, everyone! I have a really basic Triangle program that I have to make (no applets or Scanner, just calculating), but I have no idea of where to start. I'm supposed to compute the lengths of the sides, the angles, the perimeter, and the area. Right now, I'm stuck on actually setting the coordinates for each point.

Here's what I have so far:

public class Triangle {
    private int a;
    private int b;
    private int c;
    private int perimeter;
    private int area;
    private int aA;
    private int aB;
    private int aC;
    
    public Triangle(int x1, int y1, int x2, int y2, int x3, int y3)
        a = x1, y1;
        b = x2, y2;
        c = x3, y3;

What am I doing wrong?

Recommended Answers

All 2 Replies

You need parentheses to enclose your constructor. i.e.

public Triangle(int x1, int y1, int x2, int y2, int x3, int y3)
{
        a = x1, y1;
        b = x2, y2;
        c = x3, y3;
}

Oh my gosh, was that really it? I feel stupid now. Thanks for that, though! I'll be sure to ask my teacher for help on my other problems tomorrow.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.