Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is what i have so far. Not sure if i\'m doing it quite right. public void b

ID: 3648547 • Letter: T

Question

This is what i have so far. Not sure if i'm doing it quite right.

public void buildArray (String inString)
{
mystates = new States[100]; // Created the array
nElems = 0; // no items yet

name = inString.substring (0,15).trim();
capital = inString.substring (15,30).trim();
abbrev = inString.substring (30,32).trim();
pop = inString.substring (32,40).trim();
population = Integer.parseInt (pop);
region = inString.substring (40,55).trim();
regNum = Integer.parseInt (inString.substring(55,56));

insert (name, capital, abbrev, population, region, regNum);

} //End build array

Explanation / Answer

here is a sample example public enum CellType { EMPTY, WALL, POWERUP } Scanner s = new Scanner(new File("map.txt")); CellType[][] map = new CellType[8][8]; while (s.hasNext()) { String value = s.next().toUpperCase(); int x = s.nextInt(); int y = s.nextInt(); map[x][y] = CellType.valueOf(value); }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote