Guest User

Untitled

a guest
Jun 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. var Student = function (name, age, major) {
  2. Person.call(this, name, age);
  3. this.major = major;
  4. };
  5.  
  6. Student.prototype = new Person();
  7. Student.prototype.getMajor = function() {
  8. return this.major;
  9. };
  10. Student.prototype.toString = function(){
  11. return this.name + " - " + this.age + " - " + this.major;
  12. };
  13.  
  14. var Instructor = function (name, age, title) {
  15. Person.call(this, name, age);
  16. this.title = title;
  17. };
  18.  
  19. Instructor.prototype = new Person();
  20.  
  21. Instructor.prototype.getTitle = function () {
  22. return this.title
  23. };
  24. Instructor.prototype.toString = function () {
  25. return this.title + " " + this.name + " - " + this.age;
  26. };
  27.  
  28. Course = function (courseName, instructor) {
  29. this.students = []
  30. this.instructor = instructor
  31. };
  32. Course.getRoster = function() {
  33. return this.students
  34. };
  35.  
  36. Course.getCourseName = function() {
  37. return this.courseName
  38. };
  39.  
  40. Course.prototype.getAverageAge = function() {
  41. for (var i = 0; i < student.length ; i++) {
  42. ages = ages + student[i].age;
  43. };
  44. return ages/student.length;
Add Comment
Please, Sign In to add comment