forked from aneez9n/Basic-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfixToPostfix.java
More file actions
46 lines (38 loc) · 791 Bytes
/
InfixToPostfix.java
File metadata and controls
46 lines (38 loc) · 791 Bytes
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
package binaryconversion;
public class InfixToPostfix
{
Stack st ;
public InfixToPostfix(int s)
{
st = new Stack(s);
}
public int Prec(char ch)
{
switch (ch)
{
case '+':
case '-':
return 1;
case '*':
case '/':
return 2;
case '^':
return 3;
}
return -1;
}
public void infixToPostfix(String str)
{
//done in lab 5 and 6.
}
public void test(String str)
{
char ch;
for(int i=0; i<str.length(); i++)
{
ch = str.charAt(i);
st.push(ch);
}
st.display();
}
}