java language (ArrayList)

The Registrar Office at the university has asked you to help them write a Student Information System (SIS). The system can be used to store information about students, courses, and students' transcripts (courses already taken by a student). · Define a class called StudentType that holds information about a student (student ID, first name, last name, major). · Implement each member function (set, get, print, constructor, etc) in the class. · Define a class called CourseType that holds information about a course (course code, course title, number of credits). · Implement each member function (set, get, print, constructor, etc.) in the class. · Define a class called RecordType that holds information about the courses that a student has already taken (student ID, course code, course total mark, course grade, semester taken). · Implement each member function (set, get, print, constructor, etc.) in the class. Write a number of member functions that do the following: - Calculate the student GPA - Search for the highest mark taken in a particular course - Print the ID, first name, and last name of all the students who have already taken a particular course - Print the course code, course title, course mark, course grade of all courses taken by a particular student Write a main program that does the following: - Define an array of objects of each one of the above three classes - Assign data to the objects that you defined. This data should be stored and read from 3 different files - Read a student ID - Print a list of all courses taken by that student - Calculate the GPA of that student - Read a course code - Print the ID, first name, and last name of all the students who have taken that course - Search for the highest mark taken in that course - Print the ID, first name, and last name of the student who scored that highest mark in that course

Recommended Answers

All 3 Replies

thi the cod but not Complete please help me

StudenType.java

public class StudentType {

private static int ID=0;

private int studentID;

private String firstName;

private String lastName;

private String major;

------- constructor-----------

public StudentType(String fName, String lName, String theMajor) {

ID+=1;

this.studentID=ID;

this.firstName=fName;

this.lastName=lName;

this.major=theMajor;

}

-------setter methods---------

/*

public void setStudentID(int id) {

this.studentID=id;

}

*/

public void setFirstName(String fName) {

this.firstName=fName;

}

public void setLastName(String lName) {

this.lastName=lName;

}

public void setMajor(String theMajor) {

this.major=theMajor;

}

----------getter methods-----------

public int getStudentID() {

return this.studentID;

}

public String getFirstName() {

return this.firstName;

}

public String getLastName() {

return this.lastName;

}

public String getMajor() {

return this.major;

}

public String toString() {

return "Student ID: " + studentID + " First Name: " + firstName + " Last Name: " + lastName + " Major:" + major;

}

}

CourseType.java

public class CourseType {

private int courseCode;

private String courseTitle;

private int noOfCredits;

-------constructor---------

public CourseType(int code, String title, int credit) {

this.courseCode=code;

this.courseTitle=title;

this.noOfCredits=credit;

}

---------getter methods-----------

public int getCourseCode() {

return this.courseCode;

}

public String getCourseTitle() {

return this.courseTitle;

}

public int getCourseCredits() {

return this.noOfCredits;

}

------setter methods-------

public void setCourseCode(int code) {

this.courseCode=code;

}

public void setCourseTitle(String title) {

this.courseTitle=title;

}

public void setCredits(int point) {

this.noOfCredits=point;

}

public String toString() {

return "Course Code:" + courseCode + " Course Title: " + courseTitle + " No of Credits: " + noOfCredits;

}

}

RecordType.java

import java.util.ArrayList;

public class RecordType {

private StudentType student;

private ArrayList<CourseType> courses;

private ArrayList<Double> courseMarks;

private ArrayList<String> courseGrades;

private String semester;

-------- constructor---------

public RecordType(StudentType stud, ArrayList<CourseType> course, ArrayList<Double> marks, ArrayList<String> grade, String sem) {

this.student=stud;

this.courses=course;

this.courseMarks=marks;

this.courseGrades=grade;

this.semester=sem;

}

------ getter methods---------

public StudentType getStudent() {

return student;

}

public int getStudentID() {

return student.getStudentID();

}

public ArrayList<CourseType> getCourses(){

return courses;

}

public double getTotalMarks() {

double marks = 0;

for (double mark:courseMarks) {

marks+=mark;

}

return marks;

}

public ArrayList<String> getCourseGrade() {

return this.courseGrades;

}

public String getSemester() {

return semester;

}

--------setter methods----------

public void setStudent(StudentType theStud) {

student=theStud;

}

public void setMarks(ArrayList<Double> marks) {

this.courseMarks=marks;

}

public void setCourses(ArrayList<CourseType> courses) {

this.courses=courses;

}

public void setGrade(ArrayList<String> grade) {

courseGrades=grade;

}

public void setSemester(String sem) {

semester=sem;

}

public String toString() {

String output="";

output= student.toString() +"\n";

output= "Semester:" +semester +"\n";

for(int course=0; course<courses.size();course++) {

output = output + "Course Name: " + courses.get(course) + " Marks: " + courseMarks.get(course) + " Grade: " + courseGrades.get(course) +"\n";

}

return output;

}

}

Sorry about your problems but your post is suffering from a few issues. It's a typical copy and paste of the assignment and a horribly formatted code dump which makes it hard to read.

I don't see any questions by you so to some of us there are no questions but someone that did a dump and run hoping someone will complete the assignment.

Try fixing your post by telling all what issue(s) you are having on what lines plus fixing up the code formatting.

Read https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question

commented: How I can edit the post? +0

If you are inside the time limit on edits you move your mouse near the vote up+down area and the action icons will ghost into view. One of them is the Edit action.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.