
// Main program for testing the Queue object 

#import <stdio.h>
#import "Queue.h"

main ( argc, argv )
int argc;
char *argv[];
{
	id myQueue;
	float aNumber;
	
	printf ("\nCreate a Queue instance...\n");
		myQueue = [[Queue alloc] init];	            //allocate and initialize

	printf("Print the queue...\n");	
		[myQueue printQueue];				//print it out
	
	printf ("EnQueue 5.0, 10.0, then 15.0 ...\n");	//queue 3 nos.
		[myQueue  enQueue:5.0];
		[myQueue  enQueue:10.0];
		[myQueue  enQueue:15.0];
	
	printf("Print the queue...\n");	
		[myQueue printQueue];
		
	printf("Dequeue four times...\n");		//illustrate FIFO
		[myQueue deQueue:&aNumber];
		printf("Number dequeued:  %f\n", aNumber);
		[myQueue deQueue:&aNumber];
		printf("Number dequeued:  %f\n", aNumber);
		[myQueue deQueue:&aNumber];
		printf("Number dequeued:  %f\n", aNumber);
		[myQueue deQueue:&aNumber];		//empty queue will return 0.0
		printf("Number dequeued:  %f\n", aNumber);

	printf("Print the queue...\n");			//show an empty queue
		[myQueue printQueue];
		
	printf("Fill the queue again with 2.0, 4.0, 6.0, then 8.0 ...\n");    //refill
		[myQueue  enQueue:2.0];
		[myQueue  enQueue:4.0];
		[myQueue  enQueue:6.0];
		[myQueue  enQueue:8.0];
	
	printf("Print the queue...\n");			//show 4 numbers
		[myQueue printQueue];
		
	printf("Now empty the queue...\n");			//now empty it
		[myQueue empty];
	
	printf("Print the queue...\n");			//show an empty queue
		[myQueue printQueue];

	printf("Now freeing the queue...\n");	//free it up
		[myQueue  free];
	
} // end of program
