Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part I: (15 pts) Create a Student class with the following: A private String var

ID: 3634320 • Letter: P

Question

Part I: (15 pts) Create a Student class with the following:
A private String variable named “name” to store the student’s name


Part II: (15 pts) Create a Course class with the following:
A private String variable named “name” to store the course’s name, such as COP3502 etc.


Part III: (20 pts) Create a test class to check whether above classes work properly. It should be able to create Course and Student objects, enroll student or drop student to these courses, printout current enrolled courses for a given student.


I already have part 1/2 finished. I was wondering if anyone could help me design part 3.

Explanation / Answer

public class Student { private String name; private int UFID; private String DOB; private static int number; //Constructors Student(String name, int UFID, String DOB) { this.name = name; this.UFID = UFID; this.DOB = DOB; } //Get and set methods for all properties String getName() { return name; } public void setName(String newName) { name = newName; } int getUFID() { return UFID; } public void setUFID(int newUFID) { UFID = newUFID; } String getDOB() { return DOB; } public void setDOB(String newDOB) { DOB = newDOB; } } public class Course { private String name; //Name of course private Student[] students; //Declare array private int capacity; //Number of students allowed in course private int currentEnrollment; //number of students enrolled private static int numberOfCourses; //Number of courses created so far //Constructor Course(String n, int cap) { name = n; capacity = cap; students = new Student[capacity] //Create array } //Get and set methods String getName() { return name; } public void setName(String newName) { name = newName; } int getCapacity() { return capacity; } public void setCapacity(int newCapacity) { capacity = newCapacity; } //Method to add a student (s) to the course and return true if added and false if not public static boolean addStudent(Student s) { if (currentEnrollment >= capacity) { //See if course has room currentEnrollment++; return true; } else { return false; } } //Method to remove student from a class public static void removeStudent(Student s) { currentEnrollment--; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote