Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Each Student object consists of name, id , cgpa and a Registration object. This Student class uses the Registration object as one of its instance

Each Student object consists of name, id, cgpa and a Registration object. This Student
class uses the Registration object as one of its instance variables to keep track of the
information related to registration of a student. When a student adds or drops a course, his/her
Registration object gets updated.
public class Student {
private String name;
private int id;
private double cgpa;
private Registration reg;
public Student(String name, int id, double cgpa){
this.name = name;
this.id = id;
this.cgpa = cgpa;
}
// getter and setter methods
public void makeNewRegistration(){
reg = new Registration();
}
public void addCourse(Course course){
}
public void dropCourse(Course course){
}
Question: Write down the coding for dropCourse and addCourse with necessary
comments

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

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