Skip to content

Logic Problem with Exercise_06_19 #4

@SquirrelCoder

Description

@SquirrelCoder

Hi,

I think this statement is wrong: side1 + side2 > side3 || side1 + side3 > side2 || side2 + side3 > side1;
for example take the sides as follow: side1 == 5, side2 == 21 and side3 == 6, there is no way to compute this value, even though the boolean isValid method, evaluates to true, which should evaluates to false!

I think this is the right statement: side1 + side2 > side3 && side1 + side3 > side2 && side2 + side3 > side1;

btw, this method could be written as follow too:

public static boolean isValid(double side1, double side2, double side3) {
        return side1 + side2 > side3 && side1 + side3 > side2 && side2 + side3;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions