public static void Main(String[] args)
        {

            //Testing for instance creation
            Console.WriteLine("\nTesting the default constructor for BookRecord...");
            BookRecord book1 = new BookRecord();
            book1.printRecord();
            //setter tests
            Console.WriteLine("\nTesting the setter functions of BookRecord...");
            String lebook = "James Potter";
            book1.setName(lebook);
            book1.setClassification(150);
            book1.setCost(95);
            book1.setStockNum(13232);
            book1.setNumberInStock(5);
            book1.printRecord();
            String lebook2 = "Harry Potter";
            BookRecord book2 = new BookRecord(lebook2, 111, 2, 4.33);
            //getter tests
            Console.WriteLine("\nTesting the getter functions of BookRecord...");
            book2.printRecord();
            Console.WriteLine(book1.getName());
            Console.WriteLine(book1.getClassification());
            Console.WriteLine(book1.getCost());
            Console.WriteLine(book1.getNumberInStock());
            Console.WriteLine(book1.getStockNum());
            //static test
            Console.WriteLine("\nTesting static instances of BookRecord...");
            BookRecord book3 = new BookRecord();
            book3.printRecord();
            String lebook3 = "James Potter";
            book3.setName(lebook3);
            book3.setClassification(150);
            book3.setCost(95);
            book3.setStockNum(13232);
            book3.setNumberInStock(5);
            book3.printRecord();
            //Book Inventory testing!
            Console.WriteLine("\nBook Database testing begins here...");
            //Initializing some of the stubs/drivers
            Book_Database Store = new Book_Database();
            BookRecord Book1 = new BookRecord("The Great Gatsby!", 21245, 343, 19.45);
            BookRecord Book2 = new BookRecord("The Stranger", 456121, 2342, 20.55);
            BookRecord Book3 = new BookRecord("Harry Potter", 234215, 443, 49.99);
            BookRecord book = new BookRecord();
            //Testing read Inventory & printAll & getNextLine
            Console.WriteLine("\nTesting read database...");
            Store.read_Database("BookData.txt");
            Console.WriteLine("\nTesting printAll()");
            Store.PrintAll();
            //Testing addBook
            Console.WriteLine("\nTesting addBook, (& from BookRecord->setNext, getNext)...");
            Store.addBook(Book1);
            Store.addBook(Book3);
            Store.addBook(Book2);
            Store.PrintAll();
            //Testing removeBook
            Console.WriteLine("\nTesting the removeBook function....");
            Store.removeBook(456121);
            Store.removeBook(4561);
            Store.PrintAll();
            //Testing BookRecord *searchByStockNumber
            Console.WriteLine("\nTesting the BookRecord *searchByStockNumber function");
            Console.WriteLine("First one");
            book = Store.searchByStockNumber(234215);
            if (book == null)
            {
                Console.WriteLine("Nothing here bob");
            }
            else
            {
                book.printRecord();
            }
            Console.WriteLine("second one");
            book = Store.searchByStockNumber(156121);
            if (book == null)
            {
                Console.WriteLine("Sorry, nothing here bob");
            }
            else
            {
                book.printRecord();
            }
            //Testing searchByClassification
            Console.WriteLine("\nTesting the searchByClassification function");
            Store.searchByClassification(443);
            Store.searchByClassification(000);
            //Testing searchByCost
            Console.WriteLine("\nTesting the searchByCost function");
            Console.WriteLine("For 10.00 to 58.85");
            Store.searchByCost(10.00, 58.65);
            Console.WriteLine("For 20. 55 to 100");
            Store.searchByCost(20.55, 100);
            Console.WriteLine("For 100 to 1000");
            Store.searchByCost(100, 1000);
            //Testing ClearList
            Console.WriteLine("\nTesting the ClearList function");
            Store.ClearList();
            Console.WriteLine("list cleared \n");
            Store.PrintAll();
            //Re-Testing all search functions after list is cleared
            Console.WriteLine("Re-Testing all search functions after list is cleared");
            Console.WriteLine("Re-Testing searchByStockNumber");
            book = Store.searchByStockNumber(4567);
            book = Store.searchByStockNumber(156121);

            //Re-testing searchByClassification
            Console.WriteLine("\nRe-Testing searchByClassification");
            Store.searchByClassification(443);
            Store.searchByClassification(000);

            Console.WriteLine("\nRe-Testing searchByCost");
            Console.WriteLine("For 10.00 to 58.85");
            Store.searchByCost(10.00, 58.65);

            Console.WriteLine("For 20. 55 to 100");
            Store.searchByCost(20.55, 100);
            Console.WriteLine("For 100 to 1000");
            Store.searchByCost(100, 1000);

        }
        //This function reads the file and sets each line to their appropriate value
        //Note, the file must be in the same folder as the working directory/project folder
        public Boolean readInventory(String filename)
        {
            String line = "";
            int numBooks;
            if (!File.Exists(filename))
            {
                //File.Exists() returns false if the file could not be found or
                //if for some other reason the open failed.
                Console.Error.WriteLine("Unable to open file {0} in the path {1} \nProgram terminating", filename, Path.GetFullPath(filename));
                return false;
            }
            if (!(filename.ToString().Contains("txt")))
            {
                Console.Error.WriteLine("Sorry but {0} does not have file extension of .txt", filename);
            }
            try
            {
                Fread = new FileStream(filename, FileMode.Open, FileAccess.Read);
                BufFread = new BufferedStream(Fread);
                m_InFile = new StreamReader(BufFread);
            }
            catch (FileNotFoundException)
            {
                Console.Error.WriteLine("Sorry but {0} is not found in {1}", filename, Path.GetFullPath(filename));
            }

            //Read number of books, should be the first number in the inventory file
            line = getNextLine(line);
            numBooks = Convert.ToInt32(line); //Converts the number of books to an integer value
            for (int i = 0; i < numBooks; i++)
            {
                //The first loop creates a new Book Record for each book in the file.
                //The nested for loop to each the five lines that create Book Record.
                //The if statements sort each line and set them to their appropriate values.
                //When the last line is reach, the book is added to the list.
                BookRecord Book = new BookRecord();
                int j = 1;
                while (j <= 5)
                {
                    line = getNextLine(line);

                    if (j == 1)
                    {
                        Book.setStockNum(Convert.ToInt64(line));
                    }
                    else if (j == 2)
                    {
                        Book.setName(Convert.ToString(line));
                    }
                    else if (j == 3)
                    {
                        Book.setClassification(Convert.ToInt32(line));
                    }
                    else if (j == 4)
                    {
                        Book.setCost(Convert.ToDouble(line));
                    }
                    else if (j == 5)
                    {
                        Book.setNumberInStock(Convert.ToInt16(line));
                        addBook(Book);
                    }
                    j++;
                }
            }
            return true;
        }
        //The function removeBook searches for the stock number
        //of a Book Record and removes that book from the list.
        public Boolean removeBook(long stockNum)
	{
		BookRecord back = new BookRecord();
		BookRecord temp = new BookRecord();
		BookRecord delParent = new BookRecord(); //delParent = parent of node to remove, delNode = node to remove
		BookRecord delNode = new BookRecord(); 
		String tempName = "";
		temp = m_pRoot;
		back = null;
		if (temp == null)//Case 1: Checks to see there is anything in the tree
		{
			return false;
		}
		//Finding the node to delete.
		while ((temp != null) && (stockNum != temp.getStockNum()))
		{
			back = temp; //makes back the parent of temp
			if (stockNum < temp.getStockNum())
			{
				temp = temp.getLeft(); //send temp to the next node to the left
			}
			else
			{
				temp = temp.getRight(); //send temp to the next node to the right
			}
		}
		//If tree has reached the end and no book is found, a message is printed
		if (temp == null) //System didnt find anything to remove
		{
			Console.WriteLine("Book Not Found. Nothing was removed.\n");
			return false;
		}
		else //Prepare for deletion
		{
			if (temp == m_pRoot)//If the book is at the root, set delNode to root and delParent to null
			{
				delNode = m_pRoot;
				delParent = null;
			}
			else //Node to remove comes after the root node
			{
				delNode = temp;
				delParent = back;
			}
		}
		//Case 2: Removing node with zero or one child on the left
		if (delNode.getRight() == null) //The delNode has no right child
		{
			if (delParent == null) //Removing the root
			{
				m_pRoot = delNode.getLeft(); //make the left child the new root
				delNode = null;
				return true;
			}
			else //Not at root, decide which side of delParent, delNode is on
			{
				if (delParent.getLeft() == delNode) //Node to delete is a left child
				{
					delParent.setLeft(delNode.getLeft());
				}
				else //Node to delete is a right child
				{
					delParent.setRight(delNode.getLeft());
				}
				delNode = null;
				return true;
			}
		}
		else //Case 3: Deleting node has at least one child on the right
		{
			if (delNode.getLeft() == null) //The delNode has no left child
			{
				if (delParent == null)//Deleting the root
				{
					m_pRoot = delNode.getRight(); //make the right child the new root
					delNode = null;
					return true;
				}
				else //Not at root, decide which side of delParent, delNode is on
				{
					if (delParent.getLeft() == delNode) //Node to remove is a left child
					{
						delParent.setLeft(delNode.getRight());
					}
					else //Node to remove is a right child
					{
						delParent.setRight(delNode.getRight());
					}
					delNode = null;
					return true;
				}
			}
			else //Case 4: Removing node with two children.
			{
				//Find the replacement value. Locate the node containing the largest value smaller
				//than the key of the node being deleted
				temp = delNode.getLeft();
				back = delNode;
				while (temp.getRight() != null)
				{
					back = temp;
					temp = temp.getRight();
				}
				//Copy the replacement values into the
				//node to be "removed"
				tempName = temp.getName();
				delNode.setName(tempName);
				delNode.setClassification(temp.getClassification());
				delNode.setCost(temp.getCost());
				delNode.setNumberInStock(temp.getNumberInStock());
				delNode.setStockNum(temp.getStockNum());

				//delNode = temp;
				//Remove the replacement node from the tree.
				if (back == delNode)
				{
					back.setLeft(temp.getLeft());
				}
				else
				{
					back.setRight(temp.getLeft());
				}
				temp = null;
				return true;
			}
		}
	}