import java.io.*;
class student
{
private String name;
private String id; // hofstra id number
private char grade;
public String name() { return name; }
public char grade() { return grade; }
public student(String n, String i, char g)
{ name=n; id = i;
grade = g;
}
public void setgrade(char newgrade) { grade=newgrade; }
public double gradepoint()
{
if (grade=='F') return 0;
else return 4.0-((int)grade-65);
}
public void writeXML(PrintWriter pw ) throws Exception
{
pw.println("");
pw.println(" "+id+"");
pw.print(" ");
if (grade=='N') pw.print("no grade"); else
pw.print(grade);
pw.println("");
pw.println("");
}
} // student
class csc15 // ha ha
{
private student[] roster;
private int size; // the size is not necessarily the size of the class.
public csc15()
{
roster = new student[25]; // 25 is max enrollment
size = 0;
}
// add a student
public void addstudent(String name, String id, char g) throws Exception
{
if (size>= roster.length) throw new Exception("class full");
student stu = new student(name,id,g);
roster[size] = stu;
size++;
}
// lookup the grade for a student:
public char gradefor(String name) throws Exception
{
char answer = 'E'; // 'E' indicates no grade.
int i = 0;
while(i");
pw.println("\n");
for(i=0;i");
}
} // csc15 class
public class nov19
{
public static void main(String[] args)
{
csc15 section1 = new csc15();
csc15 section2 = new csc15();
try {
section1.addstudent("bilbo","700000000",'A');
section1.addstudent("frodo","700000001",'B');
section1.addstudent("gandolf","700000002",'A');
System.out.println("frodo have grade "+section1.gradefor("frodo"));
section1.havegrade('A');
FileOutputStream fos = new FileOutputStream("section1.roster");
PrintWriter pw = new PrintWriter(new OutputStreamWriter(fos));
section1.writeXML(pw);
pw.close();
} catch (Exception e) {System.out.println(e);}
} // main
}