Hermione
BAN USER- 0of 0 votes
AnswersI had one hour to write a simple object oriented java program of Student registration and de registration to a course . A particular course has some max slots that can be allocated to students . Question was simple enough but due to time constraint could not complete .Godspeed
- Hermione in United States| Report Duplicate | Flag | PURGE
Allegient Java Developer Object Oriented Design
public class InsertIntoSortedCircularLL {
public static void main(String args[]){
Node head = Node.createLinkedList();
Node curr =head;
while(curr.next != null)
curr=curr.next;
curr.next=head;
Scanner scan = new Scanner(System.in);
System.out.print("Enter element to insert : ");
int ele = scan.nextInt();
Node n = new Node(ele);
if(ele<=head.data){
n.next=head;
curr.next=n;
}
else{
curr=head;
while(curr.next.data<ele && curr.next!=head)
curr=curr.next;
n.next=curr.next;
curr.next=n;
}
curr=head.next;
System.out.print(head.data);
while(curr!=head){
System.out.print(curr.data);
curr=curr.next;
}
}
}
TDD as in ? Test Driven Development ?
- Hermione March 14, 2017