abstract class student { public final String name; // protected boolean isgraduate = false; // NOT NEEDED ANYMORE! protected double gpa; protected int credits; // number of credit hours taken // THESE ARE MOVED TO SUBCLASS: // protected String major=null; // used only for undergraduates // protected String thesistopic=null; // used only for graduates // The abstract class should only contain items that pertain to all students // constructor takes name, generates random gpa and number of credits: public student(String n) { name = n; gpa = ((int)(Math.random()*401))/100.0; // set random gpa credits = 3 + (int)(Math.random()*15); //number of credits being taken }//student constructor // ABSTRACT METHODS public abstract double tuition(); public abstract void probation_report(); }// student abstract class class undergrad extends student { protected String major; static String[] mjs= {"comp sci", "poly sci", "engineering", "math", "history", "leisure studies"}; public undergrad(String name) // constructor { super(name); // always call superclass constructor first major = mjs[(int)(Math.random()*mjs.length)]; } //implementation of abstract methods: public double tuition() { return 1200*credits;} public void probation_report() { if (gpa<2.0) System.out.println("Undergraduate student "+name+", majoring in "+major+", has an amazingly low gpa of "+gpa); } }//undergrad subclass class grad extends student { protected String thesistopic; static String[] topics = {"p equals np", "halting problem", "distributed os", "real time fault tolerance", "compiler design", "cryptography"}; public grad(String name) { super(name); thesistopic = topics[(int)(Math.random()*topics.length)]; } //implementation of abstract methods: public double tuition() { return 1600*credits; } public void probation_report() { if (gpa<3.0) System.out.println("Graduate student "+name+", who is writing a thesis on "+thesistopic+", has a gpa of only " + gpa); } }//grad subclass public class stus { public static void main(String[] argv) { // the only non-obvious code in main is used to create test cases... String[] names = {"Andrew","Dalton","Griffin","Chris","Jasper","John","Jane","Joe","Joan","Jim"}; student[] roster = new student[names.length]; // create random roster of students, alternating between grads and // undergrads, but the static type of each roster[index] is student for(int i=0;i