This shows you the differences between two versions of the page.
poo:laboratoare:13 [2021/01/19 11:12] carmen.odubasteanu |
poo:laboratoare:13 [2023/12/09 11:42] (current) carmen.odubasteanu |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Laboratorul 13. ===== | + | ===== Laboratorul 11. ===== |
=== Problema 1 - Singleton === | === Problema 1 - Singleton === | ||
Line 19: | Line 19: | ||
<code java> | <code java> | ||
public abstract class User { | public abstract class User { | ||
- | private String firstName, lastName; | + | protected String firstName, lastName; |
public User(String firstName, String lastName) { | public User(String firstName, String lastName) { | ||
this.firstName = firstName; | this.firstName = firstName; | ||
Line 42: | Line 42: | ||
User studentC = UserFactory.createUser("Student", "C", "Ionescu"); | User studentC = UserFactory.createUser("Student", "C", "Ionescu"); | ||
- | User mother = UserFactory.createUser("Parent", "MAC", "Ionescu"); | + | User mother = UserFactory.createUser("Parent", "M_AC", "Ionescu"); |
- | User father = UserFactory.createUser("Parent", "MAC", "Ionescu"); | + | User father = UserFactory.createUser("Parent", "T_AC", "Ionescu"); |
User teacher = UserFactory.createUser("Teacher", "Teacher", "Georgescu"); | User teacher = UserFactory.createUser("Teacher", "Teacher", "Georgescu"); | ||
Line 224: | Line 224: | ||
} | } | ||
public class ScoreVisitor implements Visitor { | public class ScoreVisitor implements Visitor { | ||
- | private HashMap<Teacher, ArrayList<Pair<Student, String,,! Double>>> examScores; | + | private HashMap<Teacher, ArrayList<Pair<Student, String, Double>>> examScores; |
- | private HashMap<Assistant, ArrayList<Pair<Student, String,,! Double>>> partialScores; | + | private HashMap<Assistant, ArrayList<Pair<Student, String, Double>>> partialScores; |
public ScoreVisitor(HashMap<Teacher, ArrayList<Pair<Student, String, Double>>> examScores, HashMap<Assistant, ArrayList<Pair<Student, String, Double>>> partialScores){ | public ScoreVisitor(HashMap<Teacher, ArrayList<Pair<Student, String, Double>>> examScores, HashMap<Assistant, ArrayList<Pair<Student, String, Double>>> partialScores){ | ||
this.examScores=examScores; | this.examScores=examScores; | ||
Line 256: | Line 256: | ||
<note> Folositi pentru testare main-ul de la **Factory**! </note> | <note> Folositi pentru testare main-ul de la **Factory**! </note> | ||
- | <hidden>{{:poo:laboratoare:arhiva_13.zip|Arhiva laborator}}</hidden> | + | <hidden>{{:poo:laboratoare:arhiva_13.zip|Arhiva laborator}} |
+ | </hidden> | ||