Sem1 Snipets
while (sc.hasNextLine())
{
String temp = sc.nextLine();
if (temp.equals(""))
{
// no material in this stall, add a null entry
spaces.add(null);
}
else
{
// String method split splits this string based on the
// specified token and returns an array of individual substrings
String[] tokens = temp.split(",");
String name = tokens[0];
int weight = Integer.parseInt(tokens[1]);
// add the material to the array list
spaces.add(new material(name, weight));
}
}