For the below program:
import java.util.*;
public class triangleLoop {
public static void main (String[] args) {
int height, row, col, spa;
String leftOrRight;
char hyp;
Scanner kbd = new Scanner(System.in);
System.out.println("Enter the desired height of the triangle: ");
height = kbd.nextInt();
kbd.nextLine();
System.out.println("What side do you want the hypoteneuse on? Left or Right:");
leftOrRight = kbd.nextLine().toLowerCase();
if ((leftOrRight.compareTo("left")) || (leftOrRight.compareTo("right"))) {
System.out.println("Only enter Left or Right!");
leftOrRight = kbd.nextLine().toLowerCase();
}
hyp = leftOrRight.charAt(0);
}}
I want leftOrRight to be only "left" or "right" if its not i want the user to have to keep entering strings until it meets those perameters, but my boolean expressions i think are wrong.