55.5k views
4 votes
Create a program that generates a report that displays a list of students, classes they are enrolled in and the professor who teaches that class. There are 3 files that provide the input data: 1. FinalRoster.txt : List of students and professors ( S: student, P: professor) Student row: S,Student Name, StudentID Professor row: P, Professor Name, Professor ID, Highest Education 2. FinalClassList.txt: List of classes and professor who teach them (ClassID, ClassName, ID of Professor who teach that class) 3. FinalStudentClassList.txt: List of classes the students are enrolled in. (StudentID, ClassID) The output shall be displayed on screen and stored in a file in the format described in FinalOutput.txt You will need to apply all course concepts in your solution. 1. Student and Professor should be derived from a super class "Person" 2. Every class should implement toString method to return data in the format required for output 3. Exception handling (e.g. FileNotFound etc.) must be implemented 4. Source code must be documented in JavaDoc format 5. Do not hard code number of students, professors or classes. Submit source Java files, the output file and screenshot of the output in a zip format

1 Answer

0 votes

Answer:

All the classes are mentioned with code and screenshots. . That class is shown at last.

Step-by-step explanation:

Solution

Class.Java:

Code

**

* atauthor your_name

* This class denotes Class at the college.

*

*/

public class Class {

private String className,classID;

private Professor professor;

/**

* atparam className

* atparam classID

* atparam professor

*/

public Class(String className, String classID, Professor professor) {

this.classID=classID;

this.className=className;

this.professor=professor;

}

/**

* at return classID of the class

*/

public String getClassID() {

return classID;

}

/**

* Override toString() from Object Class

*/

public String toString() {

return classID+" "+className+" "+professor.getName()+" "+professor.getEducation();

}

}

Person.Java:

Code:

/**

* atauthor your_name

* This class represents Person

*

*/

public class Person {

protected String name;

/**method to fetch name

* at return

*/

public String getName() {

return name;

}

/**method to set name

* at param name

*/

public void setName(String name) {

this.name = name;

}

Professor.java:

Code:

import java.util.ArrayList;

import java.util.List;

/**

* at author your_name

*

*This class represents professors

*

*/

public class Professor extends Person{

private String professorID, education;

private List<Class> classes=new ArrayList<Class>();

/**

* at param name

* at param professorID

* at param education

*/

public Professor(String name,String professorID,String education) {

this.name=name;

this.professorID=professorID;

this.education=education;

}

/**

* at return

*/

public String getEducation() {

return this.education;

}

/**

* at return

*/

public String getprofessorID() {

return this.professorID;

}

/** to add classes

* at param Class

*/

public void addClass(Class c) {

classes.add(c);

}

/**

* Override toString() from Object Class

*/

public String toString() {

String result=this.getName()+" - "+professorID+" - "+education;

for(Class c:classes) {

result+=c.toString()+"\\";

}

return result;

}

}

}

Student.java:

Code:

import java.util.ArrayList;

import java.util.List;

/**

* This class represents students

* at author your_Name

*

*/

public class Student extends Person{

private String studentID;

private List<Class> classes=new ArrayList<Class>();

/**

* atparam name

* atparam studentID

*/

public Student(String name,String studentID) {

this.name=name;

this.studentID=studentID;

}

/**

* atreturn

*/

public String getStudentID() {

return studentID;

}

/**

* atparam c

*/

public void addClass(Class c) {

classes.add(c);

}

/**

* atreturn

*/

public int getClassCount() {

return classes.size();

}

/**

* Override toString() from Object Class

*/

public String toString() {

String result=this.getName()+" - "+studentID+"\\";

for(Class c:classes) {

result+=c.toString()+"\\";

}

return result;

}

}

NOTE: Kindly find an attached copy of screenshot of the output, which is a part of the solution to this question

Create a program that generates a report that displays a list of students, classes-example-1
Create a program that generates a report that displays a list of students, classes-example-2
Create a program that generates a report that displays a list of students, classes-example-3
Create a program that generates a report that displays a list of students, classes-example-4
Create a program that generates a report that displays a list of students, classes-example-5
User Cliff Chew
by
4.6k points