Here is what I got so far:
import java.util.Scanner;
public class Problem6{
public static void main (String [] args){
Scanner reader = new Scanner(System.in);
int sidea, sideb, sidec;
System.out.println("Enter the length of the first side:");
sidea = reader.nextInt();
System.out.println("Enter the length of the second side:");
sideb = reader.nextInt();
System.out.println("Enter the length of the third side:");
sidec = reader.nextInt();
int isoscelesTriangle = isIsosceles(sidea, sideb, sidec);
System.out.println("The area of the square is: " + isoscelesTriangle + " cm^2.");
}
public static int isIsosceles(int sidea, int sideb, int sidec){
int isoscelesTriangle;
if (sidea == sideb || sideb == sidec || sidea == sidec) && !(sidea == sideb == sidec){
System.out.println("True");
else{
System.out.println("False");
return isoscelesTriangle;
}
}
}
}
These are the erros I get when I compile:
---------- Capture Output ----------
"C:\Program Files\Java\jdk1.7.0\bin\javac.exe" Problem6.java
Problem6.java:26: error: illegal start of expression
if (sidea == sideb || sideb == sidec || sidea == sidec) && !(sidea == sideb == sidec){
^
Problem6.java:26: error: ';' expected
if (sidea == sideb || sideb == sidec || sidea == sidec) && !(sidea == sideb == sidec){
^
Problem6.java:29: error: 'else' without 'if'
else{
^
3 errors
Terminated with exit code 1

New Topic/Question
Reply



MultiQuote




|