blob: cde22fdfe2647d6f3cb49c5fe869d6c60b169bc2 (
plain)
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
|
/**
* Budget class
*
* Create a new budget.
*/
class Budget {
#initial = 0;
#spent = 0;
#profit = 0;
constructor(initial) {
this.#initial = Number.parseFloat(initial);
}
set initial(number) {
this.#initial = Number.parseFloat(number);
}
get initial() {
return this.#initial;
}
set spent(number) {
this.#spent = Number.parseFloat(number);
}
get spent() {
return this.#spent;
}
set profit(number) {
this.#profit = Number.parseFloat(number);
}
get profit() {
return this.#profit;
}
remaining() {
return this.initial + this.profit - this.spent;
}
}
export default Budget;
|