java - I am trying to look through an array and pick out certain strings -
we have complete task ap computer science class, , figured out base of code, stuck on part. here link complete assignment if try out.
link: http://codingbat.com/prob/p254067
here code far:
public int numvworthy(string wordslist[]) { int count = 0; string w = "w"; string v = "v"; for(int = 0; < wordslist.length; i++) { if(wordslist[i].contains(v) && wordslist.length - 1 == 0) { count++; } if(wordslist[i].contains(v) && == 0) { if(!wordslist[i + 1].contains(w)) { count++; } } if(wordslist[i].contains(v) && == wordslist.length - 1) { if(!wordslist[i - 1].contains(w)) { count++; } } } return count; }
the syntax using incorect
it should be
if(wordslist[i].contains(v)) {
Comments
Post a Comment