Allegient Interview Question
Java DevelopersCountry: United States
Interview Type: Written Test
This is very simple.You would have two classes Student and Course.Student class
would have reference to Course which tells you that particuar Student has registed
to this Course and Course class would also have one maxAllocated property to store
the value of max students can be allocatedto this Course.
There would be one more class for Registration which would two methods registerCourse(String studentId, String courseId )
and degisterCourse(String studentId, String courseId ).
class Student {
String Id;
String Name;
String Email;
Address address;
String Mobile
List<Course> registerdCourses;
}
class Course {
String Id;
String Name;
int maxSlot;
}
public interface IRegistration {
public boolean registerCourse(String studentId, String courseId)
public boolean degisterCourse(String studentId, String courseId);
}
class Registration implements IRegistration {
IDataServices dataServices;
public void Registration(IDataServices dataServices){
this.dataServices = dataServices;
}
public boolean registerCourse(String studentId, String courseId){
dataServices.register(studentId, courseId);
}
public boolean degisterCourse(String studentId, String courseId){
dataServices.deregister(studentId, courseId);
}
}
2 possible classes :
- spr June 02, 2017Student - id, name
-
Course - id, name, maxslots
Registration - Student, Course
- register(StudentId, CourseId)
- deregister(StudentId, CourseId)
- getRegisteredStudents(CourseId)