Results 1 to 20 of 24
Thread: Help
- 01-12-2010, 11:45 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
- 01-12-2010, 12:53 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Maybe I could if I knew what you were talking about.
- 01-12-2010, 04:01 PM #3
yeah, here is teh codez:
Java Code:Stack = (Codez) new JavaProgram(1337);
- 01-12-2010, 05:36 PM #4
Senior Member
- Join Date
- Oct 2009
- Location
- California,US
- Posts
- 201
- Rep Power
- 4
lol,
ok heres a tutorail and examples
Stacks
- 01-13-2010, 10:13 AM #5
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
Stack Application
Hehe;) thanks for reply..but anyway I need to see a sample of java program of converting infix-postfix and postix-infix using Stack Application. Any, reply will be appreciated. Thank you.:)
- 01-13-2010, 10:21 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
A "sample" program? A "sample" program would also, coincidentally, be 90%, or more, of the work required for your assignment.
Instead of asking for a "sample" program, why don't you show us what you already have and explain, in detail, where the problem with it is.
- 01-13-2010, 10:21 AM #7
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Why do you need that sample?
So you can submit it in class as yours?
- 01-13-2010, 10:51 AM #8
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
Yes
Yes sir. Not only i can submit to class but i need to study about it. Thank you.:)
- 01-13-2010, 10:54 AM #9
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Better write your own code. That's the purpose of the assignment.
So that you can learn to write Java code.
We can help if you get stuck with your code.
- 01-13-2010, 10:59 AM #10
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
ok but i don't know how to start it. ok I will try to start my own code maybe next time when i go to internet cafe again coz i am about to time's up. thanks for your time & talk to you soon again.
- 01-13-2010, 11:03 AM #11
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
- 01-14-2010, 10:55 AM #12
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
Stack Applocation
Ok sir here I am again..this is the algorithm...
this is an example given = (5 + 3 6) * (4 6 / 5 -)
while stack is not empty
if symbol is '('
push
else
pop
I have no idea how to convert this into a java program and run. Can somebody please give me an example? Thank you.:)
- 01-14-2010, 11:02 AM #13
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
Hi masijade thanks for response. Anyway, I already sent my algorithm. Hope you can send me back an example java program. Thank you.
- 01-14-2010, 11:06 AM #14
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Look at the Stack class, and then try to implement your algorithm. Then, when you have problems with it, post your code here and we will help you correct it.
Edit: I am not, however, implying that your algorithm is correct. You should study that a bit more.
- 01-14-2010, 11:25 AM #15
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
Stack Application
Ok thank you.;)
- 01-15-2010, 12:16 AM #16
Senior Member
- Join Date
- Nov 2009
- Posts
- 235
- Rep Power
- 4
This is a helpful site for the conversion algoritham:
Infix to Postfix Conversion
- 01-17-2010, 02:39 PM #17
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
Inifx-Postfix
Oh thank you Collin..this is a big help.
- 01-17-2010, 02:43 PM #18
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0
Stack-Queue
Anyways this is a Stack.java code & how cAN i make this a Queue.java & add a length method in a Queue? There's a little bit differences between Stack & Queue my Prof said. Thank you.
public class Stack {
private Node top;
public Stack() {
top = new Node('J');
}
public void push(char c) {
Node n = new Node(c);
n.setNext(top.getNext());
top.setNext(n);
}
public boolean isEmpty() {
return top.getNext() == null;
}
public char pop() {
char c = top.getNext().getValue();
Node n = top.getNext();
top.setNext(n.getNext());
n.setNext(null);
return c;
}
public char peek() {
return top.getNext().getValue();
}
class Node {
private char value;
private Node next;
public Node(char c) {
value = c;
next = null;
}
public char getValue() {
return value;
}
public void setNext(Node n) {
next = n;
}
public Node getNext() {
return next;
}
}
}
- 01-17-2010, 04:31 PM #19
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Well, just like you looked at the API for Stack, look at the API for Queue.
- 01-19-2010, 10:46 AM #20
Member
- Join Date
- Jan 2010
- Posts
- 23
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks