View Single Post
Old 11-22-2004, 01:45 PM   #8 (permalink)
Crow T. Robot
Registered User
 
Join Date: Nov 2004
Posts: 14
Crow T. Robot is on a distinguished road
For the palindrone program, I may not necessarily need a stack, but for my assignment must use one. Here's now what I have (though I edited the earlier post I made with the code I now have). Check above for the main things I need help on with this one.

Code:
public class Lab6 extends List
{
private String string;

//create stack 
Stack stack=new Stack();

//ask user for a string
string=JOptionPane.ShowInputDialog("Enter a string: ");

//add object to stack
public synchronized void push(string)
{
insertAtFront(string);
}

//remove object from stack
public synchronized String pop() throws EmptyListException
{
return removeFromFront();
string=new string1
}

//compare characters in string for a palindrone
public static void main(String args[])
if (
{
	string=string1
}

then
{
	JOptionPane.ShowDialog("This is a palindrone.");
}

else
{
	JOptionPane.ShowDialog("This is not a palindrone.");
}
}

Last edited by Crow T. Robot; 11-22-2004 at 02:46 PM.
Crow T. Robot is offline   Reply With Quote