hi everyone..
I have this assignment that I should sort whatever I enter in ascending order of the variable a .. I want to know what is wrong with this
Thank you all in advance..
public void addRecord()
{
Scanner abc=new Scanner(System.in);
System.out.println("Enter the file number ");
int a=abc.nextInt();
System.out.println("Enter the name ");
Object b=abc.next();
System.out.println("Enterur the jender ");
Object c=abc.next();
System.out.println("Enter the blood group ");
Object d=abc.next();
System.out.println("Enter the phone number");
Object e=abc.next();
if(head!=null)
{
NodeP m=new NodeP(a,b,c,d,e);
tail.next=m;
tail=m;
NodeP t=head,p=head.next;
if(t.v1>p.v1)
{
t=head.next;
p=head;
}
while(t.next!=null)
{
if(t.v1>t.next.v1)
{
p=t;
t=t.next;
}
}
}
else
tail=head=new NodeP(a,b,c,d,e);