Below is a lab program to be submitted by Nov. 22, 02:
Write a program that will model a University. Write a class to model a Student, each student has a name and an address. Implement a method called deplayStudent that displays the information of a student in a window. Use the static method showInputDialog in the class JOptionPane, found in the javax.swing package. Each University has a list of Students that that are enrolled. Using an array to model the list of Students, implement a University class that has 50 students enrolled. Add to your university class, a method displayAllStudents that will call the displayStudent method for all the students enrolled.
I HAVE TRIED TO WRITE THE PROGRAM MYSELF BUT KEEP GETTING ERRORS THAT I CANNOT DEBUG. I AM NOT SURE HOW IMPLEMENT THE SOLUTION. I AM THERFORE SEEKING ASSISTANT IN COMPLETING IT IN TIME TO BE HANDED IN.
HERE WHAT I TRIED TO DO:
/* This class models the Student Object. It takes as input two Strings the name and the address and constructs a Student Object. */
import javax.swing.*;
public class Student { String student_name; String student_address;
But you have not defined student_list (which you appear to be treating as an array, not a List, by the way) or next_student and even if you did, you have an incomplete statement. I assume you really want to have something like this:
Where studentList is a List object, such as LinkedList or ArrayList (or even Vector).
By the way, the idea of a student containing a student list seems a bit strange. Maybe you really want the student list and the AddStudent() method to be in the University class.
I would use a for in place of your do/while, also. Other than that, I didn't look too closely at your University class. If you surround your code with [java] and [/java] mark-up tags when you post here, it will be much more readable, you know.