I have this program that I am working on that I am trying to insert user entered integers till a "-1" is detected and it will stop inserting the integers into the Tree and print it out inOrder.
I am geting 2 errors:
File: S:\makeup1.java [line: 9]
Error: S:\makeup1.java:9: cannot find symbol
symbol : class Tree
location: class makeup1
File: S:\makeup1.java [line: 9]
Error: S:\makeup1.java:9: cannot find symbol
symbol : class Tree
location: class makeup1
import java.util.Scanner;
import java.io.*;
public class makeup1{
public static void main(String [] args){
int n;
Tree t = new Tree();
Scanner scanner = new Scanner(System.in);
while(n!=-1){
System.out.println("input integer into tree: ");
n = scanner.nextInt();
insert(t,n);
}
}
public static class tree{
public int value;
public tree right;
public tree left;
public tree(int V, tree L, tree R){
{
value = V;
left = L;
right = R;
}
}
}
public static tree insert(tree t, int i){
if(t==null){
return null;
}
if(t.left!=null){
insert(t.left, i);
}
else if(t.right!=null){
insert(t.right, i);
}
}
public static tree treesort(tree t){
if(t==null){
return null;
}
if(!(t.left==null)){
return t.left;
}
return t.right;
}
}
Can anyone help me out?