arraylist - Java: removing word from a list -


i working on making vocable test can make own vocables , translation. have faced problem not know how make option have different translations pick from.

  public static void writingyourvocables(list<vocablelist> data) {    string antal = joptionpane.showinputdialog(null, "write numbers of vocables want have");   int temp  = integer.parseint(antal);    (int = 0; < temp; i++) {       string vocable = joptionpane.showinputdialog(null, "write vocable");      string translation = joptionpane.showinputdialog(null, "write translation vocable");       data.add(new vocabletest(vocable, translation));    }               }//writingyourvocables ends 

the method above the method write numbers of vocables want have in test, write vocables , translation.

  public static void playwithalternatives(list<alternatives> data) {    int = data.size();    (int n = 0; n < a; n++) {       int translate2;      int translate3;       int translate1 = (int)(math.random() * data.size()) ;       {          translate2 = (int)(math.random() * data.size()) ;       }while (translate1 == translate2);       do{          translate3 = (int)(math.random() * data.size()) ;       }while (translate1 == translate3 || translate2 == translate3);           int answer [] = {translate1, translate2, translate3};          int right = (int)(math.random() * 3) ;           int choice = integer.parseint(joptionpane.showinputdialog(null, "what translation of vocable? " +                                                                 data.get(answer[right]).getvocable() +                                                                "\n1: " + data.get(translate1).gettranslation() +                                                                 "\n2: " + data.get(translate2).gettranslation() +                                                                 "\n3: " + data.get(translate3).gettranslation()));                                                                         switch(choice){                case 1:                   if (answer[right] == translate1){                      data.remove(?);                      joptionpane.showmessagedialog(null, "right");                   }else{ joptionpane.showmessagedialog(null, "wrong");                  }                break;                case 2:                   if (answer[right] == translate2){                      data.remove(?);                      joptionpane.showmessagedialog(null, "right");                   }else{ joptionpane.showmessagedialog(null, "wring");                  }                 break;                case 3:                   if (answer[right] == translate3){                      data.remove(?);                      joptionpane.showmessagedialog(null, "right");                  }else{ joptionpane.showmessagedialog(null, "wrong");                  }                break;                default:               joptionpane.showmessagedialog( null, "wrong choice!");                                                        }           }    }//playingwithalternatives ends   

the method above method playing different alternatives translation random generated vocable. if player picks right alternative, vocable alternative connected supposed deleted. remove vocable use "data.remove()", problem not know write in brackets remove vocable.

please

there better ways handle design far question concerned remove vocable asked in first place.

data.remove(answer[right]); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -