import java.util.*;
public class triangle{
static double base,height,side3,area,perimeter;
public static void main(String[]args){
getPerimeter();
getSides();
}
public static void getPerimeter(){
Scanner in=new Scanner(System.in);
System.out.println("Enter a side of a triangle");
base=in.nextDouble();
System.out.println("Enter another side");
height=in.nextDouble();
System.out.println("Enter the last side");
side3=in.nextDouble();
System.out.println("The perimeter of your triangle is " +perimeter);
perimeter=(base+height+side3);
}
public static void getSides(){
if(base==height){
if(side3==height)
System.out.println("Your triangle is an Equilateral Triangle");
}
if(base!=height){
if(side3==height)
System.out.println("Your triangle is an Isoceles Triangle");
}
if(base==height){
if(side3!=height)
System.out.println("Your triangle is an Isoceles Triangle");
}
if(base!=height){
if(base==side3)
System.out.println("Your triangle is an Isoceles Triangle");
}
if(base!=height){
if(height!=side3)
if(side3!=base)
if(height!=base)
System.out.println("Your triangle is a Scalene Triangle");
}
System.out.println();
}
}
Can anyone help me with my code? I think there is something wrong with my first method it won't output the perimeter for me. I'm only a beginner at java so I can use some help please :]