Here's my code ... i do not know how to convert linkedlist of doubles to array . Please help me find the error.
import java.util.*;
public class StackCalculator {
private LinkedList<Double> values;
double value1 , value2 ;
public StackCalculator()
{
values = new LinkedList<Double>();
}
void push(double x)
{
values.addFirst(x);
}
double pop()
{
return values.removeFirst();
}
double add()
{
value1=pop();
value2=pop();
return (value1 + value2);
}
double mult()
{
value1=pop();
value2=pop();
return (value1 * value2);
}
double[] v = new double[10];
double[] getValues()
{
return values.toArray(v);
}
}