-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPseudo Code.txt
53 lines (37 loc) · 1.03 KB
/
Pseudo Code.txt
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
50
51
52
53
Add click event to the button to grab value.
create a varible to hold values
if button value is equal sign then, calculate the result.
else add the value to the varible holder
Goal is to:
Click the number adds to the screen
if an operator is clicked then,
goes to next set of numbers
*maybe just clear the screen*
1 varible max maybe
Calculator Object:
[local] varible to grab the values
[local] maxAmountOfDigit = 10
shape = rectangle
color = black
calculate() return result
defineProperties?
Everytime a button is check the length of the string if value >= 10 stop adding values
function Calculator() {
let values = "";
let maxAmountOfValues = 10;
this.count = 0;
this.shape = "rectangle";
this.color = "black";
this.numberToAdd = function (value) {
values += value;
this.count += 1;
};
this.reset = function () {
values = "";
this.count = 0;
};
this.calculate = function () {
return eval(values);
};
}
const calculator = new Calculator();