Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Writing 3 Java Classes for Student registration /** * A class which maintains basic information about an academic course. */ public class Course { /**

Writing 3 Java Classes for Student registration

/** * A class which maintains basic information about an academic course. */

public class Course { /** * Attributes. */ private String code; private String title; private String dept; // name of department offering the course private int credits;

/** * Constructor. */ public Course(String code, String title, int credits) { // TODO : initialize instance variables, use the static method defined in // Registrar to initialize the dept name variable }

/** * Accessor methods. */ // TODO: define a setter and a getter method for each of the instance variables

/** * public methods. */ @Override public String toString() { // TODO: implement so that a string is returned in the following format: // "INFS 612 Communication Systems

} public String fullString() { // TODO: implement so that a string is returned in the following format: //"INFS 612 Communication Systems, (3) credit hours. }

}

/** * A sub-class which extends the Course class to keep track of a student * registration in a course, and also perform */ public class TranscriptEntry extends Course { /** * Attributes * */ private String semester; private int year; private String grade; private boolean active; public TranscriptEntry(Course c, String semester, int year) { // TODO // note: active must be initialized to true.

} /** * Accessor methods methods. * // TODO * define a setter and a getter for each instance variable. * note: Do not write accessor methods for the active variable since its an internal variable: * if a course is flagged active, then the student is currently enrolled in that course. * When a grade is posted for a course, active is set to false. */ /** * Public Methods. * */ public boolean isActive() { //TODO } @Override public String toString() { // return a string with the following format: // "\tINFS 510 Database Systems, credits: 3, GRADE: A" // And if the student does not have an assigned grade, then the string value should be: // "\tINFS 510 Database Systems, credits: 3" //TODO } }

/** * The main class in the student registration program.. * This class defines public methods to provide the following functionality: * - maintains the course catalog. * - registers and drop courses for students * - at the end of semester, post grades * */ import java.util.Scanner;

public class Registrar { /** * Attributes. */ private Student [] students; private int numStudents; // keeps track of the students array size private Course [] courseCatalog; private int numCourses; // keeps track of the courseCatalog array size private String semester; private int year; /** * Constructor. */ public Registrar(String semester, int year) { // TODO. // note: maximum number of students is 100, and maximum number of courses is 50. // }

/** * Accessor methods. */ public void setSemester(String semester) { this.semester=semester;} public String getSemester() { return semester; } public void setYear(int year) { this.year=year;} public int getYear() { return year; } /** * Public methods. */ public boolean addCourse(String code, String title, int hours) { // if courseCatalog is full , return false, otherwise, add course to the catalog. // TODO } public String getCourseCatalog() { String str=""; for (Course c : courseCatalog) if (c == null) break; else str = str + c.fullString() +" "; return str; } public boolean addStudent(String fname, String lname, long id, String major, String degree, String highSchool) { // if the students array is full, return false. // otherwise add the student information to the students arrays // TODO } public boolean addStudent(String fname, String lname, long id, String major, String degree, String uMajor, String uInstit) { // an overloaded method which does the sam as the other addStudent method // TODO } public boolean register(long id, String courseCode) { // first check if the course is offered (by searching courseCatalog array using courseCode), if // the course is not found return false. // then find the student object in the students array using their id number, if no student is found // return false. // otherwise register the student in the class and return true. // TODO } public boolean drop(long id, String courseCode) { // Find the student object in the students array using their id number, if no student is found // return false. otherwise drop the course for the student. // TODO } public boolean postGrade(long id, String courseCode, int score) { // Find the student object in the students array using their id number, if no student is found // return false. otherwise post a course grade for the student. // TODO } public String getProgress(long gnum, String semester, int year) { Student s = findStudent(gnum); if (s == null) return "Student "+gnum+" not found"; String str = String.format(" %s ", s.toString()); return str+s.getClassList(semester, year); }

public static String getDeptName(String code) { // given a course code, this static method will return the name // of the academic department to which the course belong String dept = (new Scanner(code)).next(); if (dept.equalsIgnoreCase("CS")) return "Computer Science"; else if (dept.equalsIgnoreCase("INFS")) return "Information Systems"; else if (dept.equalsIgnoreCase("IT")) return "Information Tecchnoloy"; else if (dept.equalsIgnoreCase("MATH")) return "Mathematics"; else if (dept.equalsIgnoreCase("PHYS")) return "Physics"; else return null; } /** * Private methods. * you will need few helper methods. */

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Describe the value of forecasting and importance of budgeting.

Answered: 1 week ago