-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
49 lines (49 loc) · 1.27 KB
/
index.js
File metadata and controls
49 lines (49 loc) · 1.27 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
import crypto from 'crypto';
import chalkAnimation from 'chalk-animation';
const sleep = () => new Promise((resolve) => setTimeout((resolve), 2000));
async function welcomeScreen() {
let title = chalkAnimation.rainbow(`
=======================================================================
>>>>>>>>>>>>>>>>>>>>>>> STUDENT MANAGEMENT SYSTEM <<<<<<<<<<<<<<<<<<<<<
=======================================================================
`);
await sleep();
title.stop();
}
await welcomeScreen();
class Student {
name;
studentID;
balance;
course;
constructor(name) {
this.name = name;
this.studentID = crypto.randomBytes(3).toString('hex');
this.balance = 0;
this.course = [];
}
;
enroll(amount, course) {
this.balance = amount;
this.course.push(...course);
}
;
payTutionFees(amount) {
this.balance -= amount;
}
showStatus() {
console.log(`
Name:${this.name}
StudentID:${this.studentID}
studentCourse:${this.course}
Balance:${this.balance};
`);
}
;
}
;
const student1 = new Student('Ali');
student1.enroll(30005, ['metaverse', 'web3.0']);
student1.payTutionFees(3000);
student1.showStatus();