I need to build a list and then return the Min and Max number, The code I have just keeps returning 0s. Could any one help? Thnx
private SimpleList<Integer> buildList(String line) {
//Build a list of integers from line
//Assume the line is syntactically correct
SimpleList <Integer> list;
list = new SimpleList <Integer>();
int i = 0;
while (i<line.length()){
list.add(i);
i++;
}
return list;
}
private int findMax(SimpleList<Integer> list) {
//Return the maximum integer in list
list.reset();
int Max = list.next();
while (list.hasNext()){
int t = list.next();
if(t > (Max));
t = Max;
}
return Max;
}
private int findMin(SimpleList<Integer> list) {
//Return the minimum integer in list
list.reset();
int min = list.next();
while (list.hasNext()){
int x = list.next();
if(x < (min));
x = min;
}
return min;
}