Firstly, you have initialised:
BufferedWriter writerUpper = new BufferedWriter(new OutputStreamWriter(output));
But then used two other varible names:
writer.close();
And:
r.newLine();
Correct usage of BufferedWriter can be found in this documentation:http://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html
As for the if and else statements, make sure you format your code correctly. General usage of an if statement is to have a condition:
if(condition)
{
//do something
}
else
{
//do something else
}
Ie for your circumstance:
if (creditsEarned>60 writerUpper.write){
System.out.println("Student is a Lowerclassman");
else (writerLower.write){
System.out.println("Student is an Upperclassman");
}
}
Should be:
if (creditsEarned> 60){
writerUpper.write(s, 0, s.length());
writerUpper.newLine();
}
else
{
writerLower.write(s, 0, s.length());
writerLower.newLine();
}
And then make sure you use the same variable names as you initialised:
writerLower.close();
writerUppder.close();