-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntStackTest.java
More file actions
79 lines (59 loc) · 1.37 KB
/
IntStackTest.java
File metadata and controls
79 lines (59 loc) · 1.37 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
class IntStackTest
{
public static void main(String[] args)
{
IntStack is = new IntStack(10);
System.out.println(is.isEmpty());
is.push(3);
is.push(4);
is.push(5);
is.push(5);
is.push(3);
is.push(5);
//is.mode();
//is.mode(3);
//is.peek(3);
//System.out.println(is.peek());
System.out.println(is.peek(5));
/**System.out.println(is.pop());
System.out.println(is.pop());
System.out.println(is.pop());
System.out.println(is.pop());
System.out.println(is.pop());
System.out.println(is.pop());
System.out.println(is.pop());
System.out.println(is.isEmpty());
System.out.println(is.pop());**/
//pop 3 times
System.out.println(is.pop(3));
System.out.println(is.mean());
//Tests for popAall
System.out.println(is.popAll());
System.out.println(is.isEmpty());
//test peekNum:
is.push(4);
System.out.println("should be true: " + is.peekNum(4)); //should
is.push(55);
is.pop();
System.out.println("should be false: " + is.peekNum(55)); //should be false;
System.out.println(is.pop());
is.push (3);
is.push (4);
is.push (5);
is.push (6);
is.push (7);
is.push (8);
is.popUntil (4);
//fisher tests popall:
is.push (1);
is.push (2);
is.push (3);
int test =0;
while(test<3)
{
System.out.println(is.pop());
test++;
}
System.out.println(is.isEmpty());
}
}