I can't seem to get my counting loop to stop if m OR n are <=500. The loop stops only when m hits 499 right now, but I need it to cancel if n is 499. I have tried using a break statement, but I'm not sure what else to do.
Also, I know that it says palindrome....that was an entry error when I started that I haven't fixed because I've been stuck trying to figure this issue out.
public class Palindrom
{
private double m2;
private double n2;
private double LeftTriple;
private double InnerTriple;
private double RightTriple;
public void m2(double m)
{
m2 = m;
}
public void n2(double n)
{
n2 = n;
}
public void LeftTriple (double m, double n)
{
LeftTriple = (n2*n2)-(m2*m2);
}
public void InnerTriple (double m, double n)
{
InnerTriple = 2*m2*n2;
}
public void RightTriple (double m, double n)
{
RightTriple = (n2*n2) + (m2*m2);
}
public void getTriple()
{
System.out.println("[" + LeftTriple + "," + InnerTriple
+ "," + RightTriple + "]");
}
}
And my test of the above class:
import java.util.Scanner;
public class PalindromTest
{
public static void main( String[] args )
{
Palindrom Palindrome1 = new Palindrom();
double n;
double a; double b;
double m;
double i;
Scanner input = new Scanner( System.in );
System.out.println("Please Enter Value for a: ");
m = input.nextDouble();
System.out.println("Please Enter Value for b: ");
n = input.nextDouble();
if (m<n)
{
for (double count = m; m < 499; count++)
{
for(i=n; i< 499; i++ );
{
Palindrome1.m2(m);
Palindrome1.n2(n);
Palindrome1.LeftTriple(m,n);
Palindrome1.InnerTriple(m,n);
Palindrome1.RightTriple(m,n);
Palindrome1.getTriple();
m++;
n++;
}
}
}
else
System.out.println("ERROR: Value 1 must be smaller than value 2");
}
}