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

public void loadArray(String inputString) throws IOException { boolean pass = tr

ID: 3651044 • Letter: P

Question

public void loadArray(String inputString) throws IOException
{
boolean pass = true;

BufferedWriter bw;
bw = new BufferedWriter(new FileWriter("ErrorFile.2.txt"));

try
{
stateName = inputString.substring(0,15).trim();
capitalName = inputString.substring(15,30).trim();
stateAbbreviation = inputString.substring(30,32);
statePopulation = Integer.parseInt(inputString.substring(32,40).trim());
stateRegion = inputString.substring(40,55);
stateRegionNum = Integer.parseInt(inputString.substring(55,56).trim());
} //end try
catch (NumberFormatException nfe)
{
pop = inputString.substring(40).trim();
error1 = (inputString + " BAD INPUT: Bad/Invalid Population Value: "
+ pop + " ");
errorfile += error1;
bw.write(errorfile);
pass = false;
} //end catch

Explanation / Answer

just use simple english constructs to describe the code: use help from the following tutorial: http://www.codeproject.com/Articles/28441/Pseudo-Code-Modeling-Language