public void buyStock(String symbol, int quantity) throws BalanceException,
			StockNotExistException {
		boolean buyStockSucsses = false;
		int stockSymbolIndex = 0;

		if (balance <= 0) {
			throw new StockNotExistException(symbol);
		}
		// find the index of symbol
		for (int i = 0; i < portfolioSize; i++) {
			if (symbol.equals(this.stocksStatus[i].getSymbol())) {
				buyStockSucsses = true;
				stockSymbolIndex = i;
			}
		}
		// if the stock's name dosen't exists
		if (buyStockSucsses == false) {
			throw new StockNotExistException(symbol);
		}
		if (quantity == -1) {
			int numOfStocks = (int) (Math
					.floor((double) (balance / stocksStatus[stockSymbolIndex].ask)));
			this.stocksStatus[stockSymbolIndex].stockQuantity += numOfStocks;
			updateBalance(-numOfStocks * stocksStatus[stockSymbolIndex].ask);
		}

		updateBalance(-quantity * this.stocksStatus[stockSymbolIndex].ask);
		this.stocksStatus[stockSymbolIndex].stockQuantity += quantity;

	}