Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Student = function (name, age, major) {
- Person.call(this, name, age);
- this.major = major;
- };
- Student.prototype = new Person();
- Student.prototype.getMajor = function() {
- return this.major;
- };
- Student.prototype.toString = function(){
- return this.name + " - " + this.age + " - " + this.major;
- };
- var Instructor = function (name, age, title) {
- Person.call(this, name, age);
- this.title = title;
- };
- Instructor.prototype = new Person();
- Instructor.prototype.getTitle = function () {
- return this.title
- };
- Instructor.prototype.toString = function () {
- return this.title + " " + this.name + " - " + this.age;
- };
- Course = function (courseName, instructor) {
- this.students = []
- this.instructor = instructor
- };
- Course.getRoster = function() {
- return this.students
- };
- Course.getCourseName = function() {
- return this.courseName
- };
- Course.prototype.getAverageAge = function() {
- for (var i = 0; i < student.length ; i++) {
- ages = ages + student[i].age;
- };
- return ages/student.length;
Add Comment
Please, Sign In to add comment