Question

I'm trying to verify the value of an imported class.

I'm sure I'm not being as clear as I can be. Below is a link to the zip file which holds the class I'm trying to access.

zip file for class

So far I have:

 public class findHidden {

 public static void main(String[] args) {
    // TODO Auto-generated method stub

    double n=0;
    boolean a = hidden.MysterySquare.inSquare(n);
        System.out.println("a = " +a);

    while (a == true){
        n = n + .1;
    }//end while

    System.out.println("n = " +n);


}//end main

}//end class

What I want to do is pass the value of "n" through:

 boolean a = hidden.MysterySquare.inSquare(n);

and increment "n" by

 n = n + 0.1;

each time

 boolean a 

is true. And return the value of "n" when "a" is False.

Any thoughts?

Was it helpful?

Solution

public class findHidden {

 public static void main(String[] args) {
    boolean a=true;
    double n=0;
    do{
        a = hidden.MysterySquare.inSquare(n);
        System.out.println("a = " +a);
        n = n + .1;
    }while (a);//end while
    System.out.println("n = " +n);

  }//end main
}//end class

I am guessing you are trying to increment n until the return value is false?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top