Ap14 computer science a q1 - College Board
o
o
o
o private public
o
public
o
o
o [] ()
o =
==
o
[] get
o length/size
String List ArrayList
( )
o
[]
o [i,j]
[i][j]
o
int[size] nums = new int[size];
o
;
o
{ }
{ }
o
( )
o
( )
if while
bug.move()
ArayList
ArrayList
Bug bug;
Bug.move()
scrambleWord word,
) scrambleOrRemove
wordList scrambleWord
public static String scrambleWord(String word){ int current = 0; String result=""; while (current < word.length()-1){ if (word.substring(current,current+1).equals("A") && !word.substring(current+1,current+2).equals("A")){ result += word.substring(current+1,current+2); result += "A"; current += 2; } else { result += word.substring(current,current+1); current++; } } if (current < word.length()){ result += word.substring(current); } return result;
}
public static void scrambleOrRemove(List wordList){ int index = 0; while (index < wordList.size()){ String word=wordList.get(index); String scrambled=scrambleWord(word); if (word.equals(scrambled)){ wordList.remove(index); } else { wordList.set(index,scrambled); index++; } }
}
?2014 The College Board. Visit the College Board on the Web: .
?2014 The College Board. Visit the College Board on the Web: .
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
Related searches
- college computer science project ideas
- careers with a computer science degree
- a level computer science revision
- a level computer science pdf
- computer science a level pdf
- a level computer science book
- computer science a level notes
- computer science college essays examples
- a level computer science syllabus
- a level computer science textbook
- being a computer science major
- computer science a level note