Sunteți pe pagina 1din 1

Coding Advanced

I. Clasa Candidat este caracterizata de un nume complet, un numar intreg ce indica nivelul de competente si un sir de caractere ce reprezinta
numele departamentului pentru care opteaza cadidatul spre a fi angajat.

Implementati un constructor pentru clasa Candidat care sa initializeze aceste atribute din clasa.

Creati clasa clasa Companie care are un nume si contine o lista de candidati. O companie detine cel putin 2 departamente, si anume:
Marketing si Productie. Creati aceste departamente ca si clase interioare ale clasei Companie.

Aceste clase interioare retin printr-un atribut de tip numar intreg, valoarea minima a nivelului de competente necesar pentru un candidat
sa fie admis in acel departament.

Cele 2 departamente implementeaza interfata Evaluator care contine metoda evalueaza() care pentru un candidat primit ca parametru
schimba starea candidatului, in candidat respins sau candidat acceptat. Initial se presupune ca un candidat este acceptat. Un candidat
care are cel putin nivelul de competenta impus de departamentul pentru candideaza, este considerat acceptat, altfel respins.

Clasa Companie mari are o metoda recruteaza() care pe un candidat primit ca parametru, il delega spre a fi evaluat de catre departamentul
pentru care candideaza. Daca un departament primeste spre evaluare un candidat care nu a optat pentru acel departament, se arunca
exceptia de tipul IncapacitateEvaluare, impreuna cu un mesaj specific.

II. Write a program in Java programming language that:


1) Defines the classes Entity, Student, and Professor according to the following UML class diagram:

• The city must be not null and non-empty, and scholarship and salary must be strictly greater than zero. The constructors must
enforce the constraints.
• The amountReceived() method returns the amount received by the entity (scholarship for Student, and salary for Professor).
• The toString() method from the Entity class returns a string that contains the city concatenated with the amount received by that
entity.
2) Defines a function that creates and returns a list of four Entities, two Students and two Professors.
3) Defines a function that has as parameter a list of Entities and rearranges it such that the Professors are at the beginning of the list,
ordered descending by the amount received, followed by the Students, ordered ascending by the amount received.
4) Defines a function that has as parameters a list of Entities and a city, and returns the total amount received by the Entities belonging to
that city.
5) The main function of the program calls the functions indicated at (b), (c), then reads the name of a city and prints the result returned
by the function at (d).
6) For the data structures used by your program, write the specifications of the used operations.

S-ar putea să vă placă și