java - another homework question error unexpected type required:variable found:value -


i have error, unexpected type required:variable found:value , can't figure out why. code follows:

public class isbntext extends jtextfield {       protected static final int isbn_num=10;     protected static string booknum;     protected jtextfield  booktext;      protected string valid;     public isbntext()      {         super(20);     }         public string getisbn()     {                    booknum = gettext();         return booknum;     }      private string validateisbn(string booknum)throws isbnexception     {         boolean check=false;         booknum.replaceall("-","");         if (booknum.length()!=isbn_num)             throw new isbnexception ("isbn "+ booknum + " must 10 characters");         (int i=0;i<booknum.length()-1;i++)         {             if (character.isdigit(booknum.charat(i)))                 check=true;         }           if (booknum.charat(9)=='x') check=true;         if (character.isdigit(booknum.charat(9))) check=true;         if (check=false) throw new isbnexception ("isbn " + booknum + " must contain digits" +                  "or 'x' in last position");         if (checkdigit(booknum)=false)      //////////compiler   error    here////////             throw new isbnexception ("isbn " + booknum + " invalid.\n" +                  "isbn " + booknum + " should " + validnum);         if (check=true) return booknum;     }                                   public boolean checkdigit (string booknum)     {         boolean status;         double total=0.0;         char[] check   = {0,1,2,3,4,5,6,7,8,9,x};         int[] checknums= {0,1,2,3,4,5,6,7,8,9,10};         (int i=0;i<booknum.length;i++)         {             check(i)=booknum[i];             total+=check[i]*checknums[i];         }             if ((checknums[9] % 11)==check[9])             status = true;         else              status=false;     } } 

this program being used check validity of isbn number entered user. don't understand why says finds value , expects variable, booknum variable. have no doubt due limited knowledge. hoping guys can me out 1 more time.

checkdigit(booknum)=false should !checkdigit(booknum)

same thing if (check=false) should if (!check) if (check=true)

also,

for (int i=0;i<booknum.length;i++) {     check(i)=booknum[i];     total+=check[i]*checknums[i]; }     

should :

for (int i=0;i<booknum.length();i++) {     (something, not function result)=booknum.charat(i);     total+=check[i]*checknums[i]; } 

plus,

char[] check   = {0,1,2,3,4,5,6,7,8,9,x}; // x won't compile 

plus,

checkdigit has no return.

plus,

validnum not declared


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -