University Management Java Exam 2015
University Management Java Exam 2015
Java Exam
Module: Object-oriented design and Java programming Authorized documents: No
Teachers: Java Team Nombre de pages: 4
Date: 08/01/2015 Heure : 11:30 Durée: 1h30
Classes: 3INFO A, 4INFINI Main Session
MANAGEMENT OF A UNIVERSITY
We want to develop a simplified university management application. To achieve this
in our application, we ask you to complete the classes presented below.
The parts to be completed are numbered from 1 to 18.
You must include in your copies the corresponding number for each added code //TODO XX :
You must complete the entire method including the signature.
Requested work:
By specifying the number of each part to be added:
1) Complete the Student class with the methods equals, hashCode, and toString, two students are
equal in case of equality of their last name. // TODO 1 //.
2) Complete the StudentSet class grouping a set of Students in a HashSet.
Complete the methods of this class knowing that it implements the IEtuandService interface.
TODO 2 -> TODO 10
3) Complete the University class that groups for each Class all of its Students in
unHashMap. // TODO 11 -> TODO 18 //
Note 1: It is assumed that the class Class already contains the methods equals, hashCode and
[Link] classes are equal in case of equality of their labels.
Note 2: All classes are presented in the ANNEX below.
ANNEX
public class Student { public void setCin(int cin) {
private String name; [Link] = cin;
private int cin; }
private int age; public int getAge() {
private double average; return age;
public Student() { }
} public void setAge(int age) {
public Student(String name, int idCardNumber, [Link] = age;
int age, double average) { }
[Link] = name; public double getAverage() {
[Link] = cin; return average;
[Link] = age; }
[Link] = moyenne; public void setAverage(double average)
} {
public String getName() { [Link] = moyenne;
return name; }
} // TODO 1 - to be completed //
public void setName(String name) { equals, hashCode and toString
[Link] = name; (1 point) (0.5 point) (0.5 point)
}
public int getCin() { }
return cin;
}
Page 1/4
public interface IStudentService<T> {
public void addStudent(T t);
public void deleteStudent(T t);
public boolean searchStudent(Student e);
public boolean searchStudent(int idNumber);
public void display();
public TreeSet<Student> sortStudentsByName();
}
public StudentGroup() {
// TODO 3 - to be completed //(0.5 point)
}
@Override
public void ajouterEtudiant(Etudiant e) {
// TODO 4 - to be completed //(0.5 points)
}
@Override
public void supprimerEtudiant(Etudiant e) {
// TODO 5 - to be completed // (0.5 point)
}
@Override
public boolean searchStudent(Student e) {
// TODO 6 - to be completed // (0.5 points)
}
@Override
public boolean searchStudent(int cin) {
// TODO 7 - to be completed // (1 point)
/* with the stream API */
}
@Override
public void display() {
// TODO 8 - to be completed //
/* with the stream API */ (1 point)
}
@Override
public TreeSet<Student> sortStudentsByName() {
// TODO 9 - to complete Sort by name//
/* with the stream API */(1.5 points)
}
Page 2/4
public class Class {
public University() {
// TODO 11 - to be completed //(0.5 points)
}
Page 3/4
Display the names of students in a class whose age > 20 and
<23 */
}
Page 4/4