public String buyStock(Stock st, int numShares){
	if (money > numShares * st.getPrice()){ // they have enough money
	    money = money - st.getPrice() * numShares; // decrement money
	    portfolio = qs.qsort(portfolio, 0); // 0 sorts by ticker name
	    int index = -1;
	    // check if they already own some shares in that stock
	    String searchedTicker = st.getTicker();
	    // traverse until ticker is found in portfolio
	    for (int i = 0; i < portfolio.size(); i++){
		StockPosition temp = portfolio.get(i);
		String tempTicker = temp.getTicker();
		if (tempTicker.equals(searchedTicker)){ // this is the index of that ticker in portfolio
		    index = i;
		    break;
		}
	    }
	    if (index == -1){ // stock not currently owned
		StockPosition sp = new StockPosition(st, numShares);
		portfolio.add(sp);
	        return "Purchased your first " + numShares + " shares";
	    }
	    else{
		portfolio.get(index).addShares(numShares); // add the shares to existing position
		return "Purchased another " + numShares + " shares";
	    }
	}
	else{
	    return "Insufficient funds.";
	}
    }