public void buyStock(String symbol, int quantity)
	throws
		StockNotExistException,
		BalanceException
	{
		if (quantity<-1)
		{
			throw new BalanceException("you cannot buy a negative amount!");
		}
		
		for (int i=0;i<this.portfolioSize;i++)
		{
			if (symbol==this.stockStatuses[i].getSymbol())
			{
				if (this.stockStatuses[i].getAsk()>this.balance)
				{
					throw new BalanceException("the ask price for stock "+symbol+ " is higher than your total balance. you cannot buy " + symbol+" stocks right now with that amout.\n Sell some other stocks or wait for the ask price to get lower and then try again");
				}
				
				else if (quantity==-1)
				{
					if (this.stockStatuses[i].getAsk()<=this.balance)
					{
						int newQuantity = (int)(this.balance/this.stockStatuses[i].getAsk());
						this.balance -= newQuantity*this.stockStatuses[i].getAsk();
						this.stockStatuses[i].setStockQuantity(newQuantity);
						System.out.println("Successfully bought " + quantity+" stocks of stock "+symbol +". \n Current balance is "+this.balance);
					} 
				}
				
				else if (quantity*this.stockStatuses[i].getAsk()>this.balance)
				{
					throw new BalanceException("You don't have enough credits to buy "+quantity+" units of stock "+symbol+"\n. Ask for less "+quantity+" amount of stock "+symbol+" or sell other stocks first.");
				}
				else if ((quantity+1)*this.stockStatuses[i].getAsk()>=this.balance)
				{
					this.stockStatuses[i].setStockQuantity(quantity);
					this.balance -= (this.stockStatuses[i].getAsk()*quantity);
					System.out.println("Successfully bought " + quantity+" stocks of stock "+symbol +". \n Current balance is "+this.balance);
				}
				else if ((quantity)*this.stockStatuses[i].getAsk()<this.balance)
				{
					this.stockStatuses[i].setStockQuantity(quantity);
					this.balance -= (this.stockStatuses[i].getAsk()*quantity);
					System.out.println("Successfully bought " + quantity+" stocks of stock "+symbol +". \n Current balance is "+this.balance);
				}
			}
			 
		}
		throw new StockNotExistException(symbol);
	}