Hong-Phuc Bui
2025-01-16 2889de7f0c2d587a17fbd322af57c29e84238620
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
export class Lecture {
    constructor(name, ects, sws) {
        this._name = name;
        this._ects = ects;
        this._sws = sws;
    }
 
    effortPerWeek(weeks = 15) {
        const ECTS_COST = 30;     // Wieviel Aufwand in Zeitstunden für einen ECST-Punkt
        const DS_LENGTH = 1.5;    // Stunden pro Doppelstunden
        let timeOfEcts = this._ects * ECTS_COST;
        let sumTimePerWeek = timeOfEcts / weeks;
        let lectureTimePerWeek = DS_LENGTH * (this._sws / 2);
        return sumTimePerWeek - lectureTimePerWeek;
    }
 
    toString() {
        return `${this._name}|${this._ects} ECTS|${this._sws} SWS`;
    }
 
    set sws(sws) {
        if(sws <= 0) {
            throw new RangeError("SWS must be positiv");
        }
        this._sws = sws;
    }
 
    get sws() {
        return this._sws;
    }
 
    set ects(ects) {
        if(ects <= 0) {
            throw new RangeError("ECTS must be positiv")
        }
        this._ects = ects;
    }
 
    get ects() {
        return this._ects;
    }
 
    get name() {
        return this._name;
    }
}