Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Use Java Create 2 Classes Class Maintains Basic Information Academic Course Public Static Q35627398

USE JAVA , CREATE 2 CLASSES

/**
* A class which maintains basic information about an academiccourse.
*/

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

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

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

/**
* public methods.
*/
@Override
public String toString() {

  
// TODO: implement so that a string is returned in the followingformat:
// “tINFS 612 Communication Systems (3)”

}

public String fullString() {
  
// TODO: implement so that a string is returned in the followingformat:
//”tINFS 612 Communication Systems (3) credit hours”

}

}

/**
* A sub-class which extends the Course class to keep track of astudent
* 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 sinceits an internal variable:
* if a course is flagged active, then the student is currentlyenrolled in that course.
* When a grade is posted for a course, active is set tofalse.
*/
  
  
/**
* Public Mathods.
*
*/
  
public boolean isActive() {
//TODO
}

  
@Override
public String toString() {
// return a string with the following format:
// “tINFS 510 Database Systems, credits: 3, GRADE: A”

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

public class Registrar {
  
/**
* Attributes.
*/
private Student [] students;
private int numStudents; // keeps track of the students arraysize
private Course [] courseCatalog;
private int numCourses; // keeps track of the courseCatalog arraysize
private String semester;
private int year;

/**
* Constructor.
*/
public Registrar(String semester, int year) {
// TODO.
// note: maximum number of students is 100, and maximum number ofcourses 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 courseto the catalog.
// TODO
}

public String getCourseCatalog() {
String str=””;
for (Course c : courseCatalog)
if (c == null) break;
else str = str + c.fullString() +”n”;
return str;
}

public boolean addStudent(String fname, String lname, long gnum,String major,
String degree, String highSchool) {
// if the students array is full, return false.
// otherwise add the student information to the studentsarrays
// TODO
}

public boolean addStudent(String fname, String lname, long gnum,String major,
String degree, String uMajor, String uInstit) {
// an overloaded method which does the sam as the other addStudentmethod
// TODO
}

public boolean register(long gnum, String courseCode) {
// first check if the course is offered (by searching courseCatalogarray using courseCode), if
// the course is not found return false.
// then find the student object in the students array using theirgnum, if no student is found
// return false.
// otherwise register the student in the class and returntrue.
// TODO
}
  
public boolean drop(long gnum, String courseCode) {
// Find the student object in the students array using their gnum,if no student is found
// return false. otherwise drop the course for the student.
// TODO
}
  
public boolean postGrade(long gnum, String courseCode, int score){
// Find the student object in the students array using their gnum,if no student is found
// return false. otherwise post a course grade for thestudent.
// 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(” %sn”, s.toString());
return str+s.getClassList(semester, year);
}

public static String getDeptName(String code) {
// given a course code, this static method will return thename
// 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.
*/

  
  
}

//TODO
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *