Advertisement
Guest User

lalalala

a guest
Nov 14th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1.  
  2. public class Journal
  3. {
  4. private String titel;
  5. private String publisher;
  6. private Integer volume;
  7. private String year;
  8. private ArrayList<Employees> circulationList;
  9.  
  10. /**
  11. * Constructor for objects of class Journal
  12. */
  13. public Journal(String newTitel, String newPublisher, Integer newVolume, String newYear)
  14. {
  15. titel= newTitel;
  16. publisher= newPublisher;
  17. volume= newVolume;
  18. year= newYear;
  19. circulationList =new ArrayList<Employees>();
  20.  
  21. }
  22.  
  23. public void setTitel(String newTitel)
  24. {
  25. titel= newTitel;
  26. }
  27. public String getTitel()
  28. {
  29. return titel;
  30. }
  31. public void setPublisher(String newPublisher)
  32. {
  33. publisher= newPublisher;
  34. }
  35. public String getPublisher()
  36. {
  37. return publisher;
  38. }
  39. public void setVolume(Integer newVolume)
  40. {
  41. volume= newVolume;
  42. }
  43. public Integer volume()
  44. {
  45. return volume;
  46. }
  47. public void setYear(String newYear)
  48. {
  49. year=newYear;
  50. }
  51. public String getYear()
  52. {
  53. return year;
  54. }
  55. /**
  56. * Exercise 2.
  57. */
  58.  
  59. public void addEmployee(String empName)
  60. {
  61. Employees emp = new Employees(empName);
  62. circulationList.add(emp);
  63. if (circulationList.contains(empName))
  64. {System.out.println("You are already in the system");}
  65. circulationList.add(empName);
  66. }
  67. /**
  68. * Exercise 3.
  69. */
  70. public void printCirculationList()
  71. {
  72. for(Employees emp : circulationList)
  73. {
  74. System.out.println(emp.getEmpName());
  75. }
  76.  
  77. }
  78.  
  79. /**
  80. * Exercise 4.
  81. */
  82. public void removeEmployee(String empName)
  83. {
  84.  
  85. int index = 0;
  86. boolean found = false;
  87. int amount = circulationList.size();
  88. while(index < amount && !found)
  89. {
  90.  
  91. String element = circulationList.get(index);
  92. if(element.contains(empName))
  93. {
  94.  
  95. found = true;
  96. circuList.remove(empName);
  97. System.out.println(empName + " is removed from the circulation List.");
  98. }
  99.  
  100. else
  101. {
  102.  
  103. System.out.println(empName + " is not listed in the circulation list.");
  104. }
  105. }
  106.  
  107.  
  108. }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement