little coding help [ very simple need quick replies ;) ]

Joined
Feb 27, 2009
Messages
1
Reaction score
0
ok, my problem is this...

i have a while loop that isnt working like i want it to. My goal is for the program to stay inside the while loop until the three tests == True.

im testing to see if the entry is unique, if it is legal (1-9) and if the column choice is legal(0-8). Now what i need is for it to keep checking those Until all three are true then to exit the while loop.


even now when i reread my words something doesnt make sense... basically i have a string based on soduku game, "-1--37-9-". The code is very simple and justs asks for what number u want to add and where u want to add it. When i put in an illegal number or illegal place to add it, it tells me theres an error like "That number is already in the Row" YET it still adds the number in ><...
Code:
public void updateRow (String entryString, String columnString)
    { 
      boolean test = false;  
      int xEntryString = Integer.parseInt(entryString);
      int xColumnString = Integer.parseInt(columnString);
      while (test = false); // I cant get it to not still add the number in if all the tests == false.
     {
      if (isLegalEntry(xEntryString) == false)
        {
          System.out.println("Not a Legal Entry (1-9)");
        }
        else if (isUniqueEntry(entryString) == false)
        {
          System.out.println(entryString + " already appears in the row.");
        }
        else if (isLegalColumn(xColumnString) == false)
        {
          System.out.println("Not a legal column (0-8)");
        }
        test = true;
      }
      
     
      String newString = row.substring(0,xColumnString).concat(entryString).concat(row.substring(xColumnString,8));
      row = newString;
        
        
    }
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top