import java.util.Scanner;

public class Exercise3_1 {
    public static void main (String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter three edges: ");
         int integer = input.nextInt();
        int edge1 = 1;
        int edge2 = 1;
        int edge3 = 1;
        // First condition: edge1 + edge2 should be greater than or equal to edge3
        boolean triangle = (edge1 + edge2 >= edge3);
        // Second condition: edge1 + edge3 should be greater than edge2
        triangle =!(triangle && (edge1 + edge3 > edge2));
        // Third condition: edge2 + edge3 should be greater than edge1
        triangle =!(triangle && (edge2 + edge3 > edge1));
        System.out.println("Can edges " + edge1 + ", " + edge2 + "," + " " + "and "  +   edge3 + " form a triangle? " + triangle);
        }
}

Please explain what the problem is.
Show the program's output and explain what is wrong with it and show what you want the output to be.

Well, when I submit the assingment, the correct output should generates : Enter three edges: Can edges 5, 1, and 1 form a triangle? false... while mine generates: Enter three edges: Can edges 1, 1, and 1 form a triangle? true... then in the second round the correct output should be- Enter three edges: Can edges 2, 2, and 3 form a triangle? true.. and mine generates Can edges 1, 1, and 1 form a triangle? true

Can you show Exactly what the program outputs
and then show exactly what you want the output to be
instead of writing it as a paragraph with wrapping lines etc?

Here is what I get when I execute the code:

Enter three edges: 111
Can edges 1, 1, and 1 form a triangle? true

My output is: Enter three edges: Can edges 1, 1, and 1 form a triangle? tru

the output should be: Enter three edges: Can edges 2, 2, and 3 form a triangle? tru

My output is: Enter three edges: Can edges 1, 1, and 1 form a triangle? tru

the out put should be: Enter three edges: Can edges 5, 1, and 1 form a triangle? false

yes and when I submit the assignment... the code satisfies one of the three outputs... my program is not generating the first two outputs i listed above

Your code assigns the value of 1 to the three variables that are used in the logic.
If you want different values to be used and printed out you need to change the values that are assigned to those variables. For example:

int edge1 = 2;
int edge2 = 2;
int edge3 = 3;

Your copy of the console does NOT show what you entered. Why is that?
Look at my post, it shows that I entered 111

when I submit the assignment this is what I get:

[0] => copied your uploaded file to /home/bmexia0/Exercise3_1.java
[1] => Testing File: /home/bmexia0/Exercise3_1.java
[2] => /home/bmexia0
[3] => Compiling /home/bmexia0/Exercise3_1.java...
[4] => Compiled Okay
[5] => Testing Exercise3_1.java Round 0 : its not okay!
[6] => diff side by side difference, common lines suppressed showing first 130 Characters
[7] => Your incorrect output left side, solution right hand side.
[8] => Enter three edges: Can edges 2, 2, and 3 form a triangle? tru | Enter three edges: Can edges 1, 1, and 1 form a triangle? tru
[9] => Character Dump Your Output...
[10] => 0000000 E n t e r t h r e e e d g e
[11] => 0000020 s : C a n e d g e s 2 ,
[12] => 0000040 2 , a n d 3 f o r m a
[13] => 0000060 t r i a n g l e ? t r u e \n
[14] => 0000077
[15] => Character Dump Solution...
[16] => 0000000 E n t e r t h r e e e d g e
[17] => 0000020 s : C a n e d g e s 1 ,
[18] => 0000040 1 , a n d 1 f o r m a
[19] => 0000060 t r i a n g l e ? t r u e \n
[20] => 0000077
[21] => Testing Exercise3_1.java Round 1 : its aokay
[22] => Testing Exercise3_1.java Round 2 : its not okay!
[23] => diff side by side difference, common lines suppressed showing first 130 Characters
[24] => Your incorrect output left side, solution right hand side.
[25] => Enter three edges: Can edges 2, 2, and 3 form a triangle? tru | Enter three edges: Can edges 5, 1, and 1 form a triangle? fal
[26] => Character Dump Your Output...
[27] => 0000000 E n t e r t h r e e e d g e
[28] => 0000020 s : C a n e d g e s 2 ,
[29] => 0000040 2 , a n d 3 f o r m a
[30] => 0000060 t r i a n g l e ? t r u e \n
[31] => 0000077
[32] => Character Dump Solution...
[33] => 0000000 E n t e r t h r e e e d g e
[34] => 0000020 s : C a n e d g e s 5 ,
[35] => 0000040 1 , a n d 1 f o r m a
[36] => 0000060 t r i a n g l e ? f a l s e \n
[37] => 0000100
[38] => 1 out of 3 Percentage 33.00

Sorry im so new to this

Sorry, I'm not familiar with how you are having your program executed.
I execute my programs with the java command in a command prompt console.

The way you have your program written, you have to edit it to change the numbers being used for the testing.
The program prints a message and reads an integer from the user but then does not do anything with that number.

What is the program supposed to do when it executes? Explain what the user will see and what the user is supposed to do when the program is executed.

this is the correct program... i got it:) thank you!

import java.util.Scanner;

public class Exercise3_1 {
    public static void main (String[] args) {
        // Input
        Scanner input = new Scanner(System.in);
        System.out.print("Enter three edges: ");
        int edge1 = input.nextInt();

        int edge2 = input.nextInt();

        int edge3 = input.nextInt();

        //Process

        // First condition: edge1 + edge2 should be greater than or equal to edge3
        boolean triangle = (edge1 + edge2 >= edge3);
        // Second condition: edge1 + edge3 should be greater than edge2
        triangle =(triangle && (edge1 + edge3 > edge2));
        // Third condition: edge2 + edge3 should be greater than edge1
        triangle =(triangle && (edge2 + edge3 > edge1));

        //Output

        System.out.println("Can edges " + edge1 + ", " + edge2 + "," + " " + "and " + edge3 + " form a triangle? " + triangle);

        }
        }

Now you are getting the three numbers from the user.

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.