When I run my program, it writes the elements outside of the for loop into the file however the contents in the for loop are not written to the file.
public static void main(String[] args) {
PrintWriter out;
try {
out = new PrintWriter("OUTPUT");
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
out.write("Participant ID Date of Data Collection Time of Data Collection HR\n");
for (Participant p : participants) {
// Write the participant information to the OUTPUT file
out.write(p.getID() + " " + p.getDate() + " " + p.getTime() + " " + " " +
p.getHR());
}
out.close();
}
}