-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (30 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const School = require('./school');
const { Admin } = require('./roles');
const GradeCalculator = require('./gradeCalculator');
//instance to test-system
// Create a school instance
const mySchool = new School('Midnyt School');
// Add roles
const admin = new Admin('John Doe', 'admin1234');
mySchool.addRole(admin);
// Admin adds student
admin.addStudent(mySchool, 'Alice', '101', 'Grade 5');
admin.addStudent(mySchool, 'Bob', '102', 'Grade 6');
// Admin adds grades for a student
GradeCalculator.addGrades(mySchool.getStudentById('101'), {
Math: 85,
English: 90,
Science: 78,
});
GradeCalculator.addGrades(mySchool.getStudentById('102'), {
Math: 70,
English: 65,
Science: 80,
});
// Viewing details as admin
console.log('Admin View:', admin.viewStudents(mySchool));
// Simulating Parent and Student views
const parentView = mySchool.getParentView('101');
console.log('Parent View for Student 101:', parentView);
const studentView = mySchool.getStudentView('102');
console.log('Student View for Student 102:', studentView);