Show StudentsADT interface
interface StudentsADT
{
void admissions();
void discharge();
void transfers();
}
public class Course
{
String cname;
int cno;
int credits;
public Course()
{
System.out.println("\nDEFAULT constructor called");
}
public Course(String c)
{
System.out.println("\noverloaded constructor called");
cname=c;
}
public Course(Course ch)
{
System.out.println("\nCopy constructor called");
cname=ch;
}
void setCourseName(String ch)
{
cname=ch;
System.out.println("\n"+cname);
}
void setSelectionNumber(int cno1)
{
cno=cno1;
System.out.println("\n"+cno);
}
void setNumberOfCredits(int cdit)
{
credits=cdit;
System.out.println("\n"+credits);
}
void setLink()
{
System.out.println("\nset link");
}
String getCourseName()
{
System.out.println("\n"+cname);
}
int getSelectionNumber()
{
System.out.println("\n"+cno);
}
int getNumberOfCredits()
{
System.out.println("\n"+credits);
}
void getLink()
{
System.out.println("\ninside get link");
}
}
public class Students
{
String sname;
int cno;
int credits;
int maxno;
public Students()
{
System.out.println("\nDEFAULT constructor called");
}
public Students(String c)
{
System.out.println("\noverloaded constructor called");
cname=c;
}
public Students(Students ch)
{
System.out.println("\nCopy constructor called");
cname=ch;
}
void setMaxNumberOfStudents(int n)
{
maxno=n;
}
void addStudent(String snam)
{
sname=snam;
}
void addCourse(int cno1,String cname1)
{
cno=cno1;
cname=cname1;
}
void dropCourse(int cno1,String cname1)
{
cno=0;
cname="null";
}
public class Student
{
String sname;
int cno;
int credits;
int id;
String course;
public Student()
{
System.out.println("\nDEFAULT constructor called");
}
public Student(String c)
{
System.out.println("\noverloaded constructor called");
cname=c;
}
void setId(int id1)
{
id=id1;
}
void setCourses(String course1)
{
course=course1;
}
void addCourse(int cno1,String cname1)
{
cno=cno1;
cname=cname1;
}
void dropCourse(int cno,String cname)
{
cno=0;
cname="null";
}
public static void main(String args[])
{
}
}
}
1. Show StudentsADT interface
2. Create a Course class with the following methods: default constructor,
overloaded constructor, copy constructor, setCourseName, setSectionNumber,
setNumberOfCredits, setLink, getCourseName, getSectionNumber,
getNumberOfCredits, getLink, toString
3. Create a Students class with the following methods: default constructor,
overloaded constructor, copy constructor, setMaxNumberOfStudents,
addStudent, addCourse (pass 2 args), dropCourse (2 args), toString
4. Create an Inner class called Student inside Students class with the following
methods: default constructor, overloaded constructor, setID, setCourses,
getID, getCourses, addCourse (pass 1 arg), dropCourse (1 arg), toString
5. Create a StudentsDemo class by adding the students with IDs: 1111, 1234, 2357
- Display the following menu:
“What action would you like to implement?”
1: Show all Students
2: Add a Course
3: Drop a Course
9: Quit
please do number 5 relying on the code above
dont use others answers please
Trending now
This is a popular solution!
Step by step
Solved in 2 steps