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.");
}
}