This shows you the differences between two versions of the page.
poo-ca-cd:laboratoare:polimorfism [2024/10/27 18:42] valentin.carauleanu [Summary] |
poo-ca-cd:laboratoare:polimorfism [2024/10/27 18:45] (current) valentin.carauleanu [Summary] |
||
---|---|---|---|
Line 185: | Line 185: | ||
</note> | </note> | ||
- | ## Task 1 [1p] | + | ** Task 1 [1p] ** |
In clasa Employee adaugati 3 parametri `private`: name (String), salary (double) | In clasa Employee adaugati 3 parametri `private`: name (String), salary (double) | ||
Line 202: | Line 202: | ||
[Position: Developer] | [Position: Developer] | ||
- | ## Task 2 [1p] | + | ** Task 2 [1p] ** |
Implementati metoda `calculateBonus` in clasa `Employee` care va salariul * 0.05. | Implementati metoda `calculateBonus` in clasa `Employee` care va salariul * 0.05. | ||
Line 210: | Line 210: | ||
- pentru `Developer` bonusul va fi salariul * 0.15 | - pentru `Developer` bonusul va fi salariul * 0.15 | ||
- | ## Task 3 [1p] | + | ** Task 3 [1p] ** |
Implementati metoda `validateEmployee` in clasa `Employee` care va verifica daca | Implementati metoda `validateEmployee` in clasa `Employee` care va verifica daca | ||
Line 217: | Line 217: | ||
be 18 or older.` cand varsta este mai mica de 18. | be 18 or older.` cand varsta este mai mica de 18. | ||
- | ## Task 4 [2p] | + | ** Task 4 [2p] ** |
Pentru clasele `Manager` si `Developer` adaugati un parametru `private` | Pentru clasele `Manager` si `Developer` adaugati un parametru `private` | ||
Line 232: | Line 232: | ||
- pentru `Developer` va afisa: `Employee details: Developer with Y projects.` | - pentru `Developer` va afisa: `Employee details: Developer with Y projects.` | ||
- | ## Task 5 [2p] | + | ** Task 5 [2p] ** |
Suprascrieti metoda `validateEmployee` in clasele copil astfel: | Suprascrieti metoda `validateEmployee` in clasele copil astfel: | ||
Line 240: | Line 240: | ||
va afisa mesajul `Number of projects must be 1 or greater.`. | va afisa mesajul `Number of projects must be 1 or greater.`. | ||
- | ## Task 6 [2p] | + | ** Task 6 [2p] ** |
Supraincarcati metoda `calculateBonus` in clasele copil astfel incat sa primeasca un | Supraincarcati metoda `calculateBonus` in clasele copil astfel incat sa primeasca un | ||
Line 248: | Line 248: | ||
- pentru `Developer` bonusul va fi salariul * 0.15 + bonus * numarul de proiecte | - pentru `Developer` bonusul va fi salariul * 0.15 + bonus * numarul de proiecte | ||
- | ## Task 7 [1p] | + | ** Task 7 [1p] ** |
Adugati metoda compareSalary in clasa `Employee` care va primi un obiect de tip Employee. | Adugati metoda compareSalary in clasa `Employee` care va primi un obiect de tip Employee. | ||
Line 264: | Line 264: | ||
- | ### Example: | + | ** Example: ** |
- | **Input** | + | **Input:** |
- | ```plaintext | + | |
1 | 1 | ||
- | ``` | + | |
**Expected Output** | **Expected Output** | ||
- | ```plaintext | ||
Name: John, Salary: 5000.0, Age: 35 [Position: Manager] | Name: John, Salary: 5000.0, Age: 35 [Position: Manager] | ||
- | ``` | + | |