Java Newbie. I need help?

ronghuilu

New member
Joined
Mar 18, 2009
Messages
3
Reaction score
0
Points
1
An application that reads 3 nonzero values entered by the user and determines and prints whether they could represent the sides of triangle
 
have 3 println statements and scan the inputs in using a Scanner.
then find which 2 side lengths are smaller, and see the if the sum is > the 3rd side

intantiates a Scanner instance
Scanner keyboard = new Scanner(System.in);
use keyboard.nextInt(); to input numbers
if (a>b&&b>c)
if(a<b&&b<c)
if (b>a&&a>c)

try those to find your bigger side

// assuming a was the bigger side
if ((b+c)>a)
System.out.println("you have a triangle.");
else
S.o.p("no triangle can exist");


hope i helped.
good luck
 
Back
Top