• Post Reply Bookmark Topic Watch Topic
  • New Topic

Delimiter Matching Algorithm works but...  RSS feed

 
Adnan Alvee
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have LinkedStack class, what I simply want to do is make a delimiter match alogorithm, I also have the working algorithm for it but the problem is implementing the algorithm . I'm just stuck in my POP method and which will fix just one line of algorithm currently showing incompatible types.

I have a abstract DataElement class, A CharElement class extending DataElement and a LinkedStack class. My LinkedStacked class has all the push, pop and peek methods. I need help in making the pop method a char type.

Below is my LinkedStack Class, just before the class ends, I have the pop method, so you can scroll all the way down and see the method.
Here is what I had previously, this method below worked perfectly when I tried to create a stack, and then peek and pop and then push again; but not with the delimiter algorithm method in my tester.






here is my tester,
there is still stuff to write but having an error on one line of the method 'i'sdelimitermatching', I have marked it with arrows!




Well I have the major part of the code but the problem is the Pop method, I need it to cut the head of my stack, i mean remove the top and at the same time return me the top that it just took off so that I can store in the char variable in my "isDelimittermatching" method(Marked with arrows above).
Please help me out write the pop method! Have been trying for ours now!

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!