Re: O.T Help sought from Java Programmers
First, in the constructor you inverted your assignments - it should be studentID = sId, instead of sId = studentID, etc. Then, your fields should be private. You also need setters. And probably not everything should be a String, but that's less important.
In printDetails() you would use a StringBuilder class to combine all those Strings from fields into one String the method will return.
Enrollment would have one array of Student objects, addStudent() would add a new student to the array and return the index, getStudent() would use the index to retrieve the Student object, printEnrolment would iterate through the array and invoke printdetails on each student and write that to System.out. It would be useful to have a method to return the number of Students as well.
Admin would have the Main method in which he would call filData and then searchStudent in a loop until he gets a result. fillData creates an Enrollment object, then Student object whose data are hardcoded and inputs them into the enrollment using addStudent, then finally printsEnrollment. searchStudent takes a year, then calls getStudent for each Student, takes his year and if it matches prints his data to System.out; it returns true if successful, otherwise false.
Anyway, that's how I understood what you are expected to do. I know it's a total beginner level project, but I think it's very poorly composed.
|