Advertisement
Evyatar12

Grade

Nov 28th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Nodes
  8. {
  9. class Grade
  10. {
  11. private Class[] classes { get; }
  12.  
  13. public Grade(Class[] classes)
  14. {
  15. this.classes = classes;
  16. }
  17.  
  18. public int numberOfSubjects(int ID)
  19. {
  20. foreach (Class c in classes)
  21. {
  22. Node<Student> pos = c.getStudents();
  23.  
  24. while (pos != null)
  25. {
  26. if (pos.getValue().ID == ID)
  27. {
  28. return LinkedListUtils.listLength(pos.getValue().getSubjects());
  29. }
  30. }
  31. }
  32.  
  33. return -1;
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement