0

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?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by DivineRose
0

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;
}
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.