0% found this document useful (0 votes)
4 views4 pages

University Management Java Exam 2015

The document outlines a Java exam for the academic year 2015-2016 focused on object-oriented design and Java programming. It requires students to complete various classes related to a university management application, including methods for handling students and classes. The exam consists of 18 specific tasks to be completed, emphasizing the implementation of methods such as equals, hashCode, and toString, as well as various operations on student data.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

University Management Java Exam 2015

The document outlines a Java exam for the academic year 2015-2016 focused on object-oriented design and Java programming. It requires students to complete various classes related to a university management application, including methods for handling students and classes. The exam consists of 18 specific tasks to be completed, emphasizing the implementation of methods such as equals, hashCode, and toString, as well as various operations on student data.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Academic Year: 2015-2016

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 class StudentEnsemble // TODO 2 - to be completed // (0.5 points)


{

public Set<Etudiant> etudiants;

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)
}

public double sumOfAverages() {


// TODO 10 - to be completed//
/* with the stream API */(2 points)
}
}

Page 2/4
public class Class {

private String label;


private int capacity;

public Class(String label, int capacity) {


[Link] = label;
[Link] = capacite;
}

public String getLabel() {


return label;
}

public void setLabel(String label) {


[Link] = label;
}

public int getCapacity() {


return capacity;
}

public void setCapacity(int capacity) {


[Link] = capacite;
}
}

public class University {

private String name;


private Map<Classe, EnsembleEtudiants> map;

public University() {
// TODO 11 - to be completed //(0.5 points)
}

public void addClass(Class c) {


// TODO 12 - to be completed //(0.5 point)
}

public void addStudent(Student e, Class c) {


// TODO 13 - to be completed //(1.5 point)
}

public void moveStudent(Student e, DestinationClass class) {


// TODO 14 - to be completed //(1 point)
The student must be removed from their first class.
}

public void swapStudent(Student e1, Student e2) {


// TODO 15 - to complete //(2 points)
Both students must exist.
}

public void afficherUniversity() {


// TODO 16 - to be completed //(1 point)
Use Lambda Expression or Stream API
}

public void displayStudentNameAndAge(Class c) {


// TODO 17 - to be completed//(1.5 points)
with the stream API

Page 3/4
Display the names of students in a class whose age > 20 and
<23 */
}

public List<Student> bestStudents() {


// TODO 18 - to be completed//(2 points)
/* with the stream API */
Return the first ten students according to
their averages in a list */
}
}

Page 4/4

You might also like