public synchronized static Collection sellStock(String tickername,
			User username, int no, ArrayList<User> users,
			ArrayList<Stock> stocks) {
		stocks = DataReader.getStocks();
		users = DataReader.getUsers();
		tickername = tickername.toUpperCase();
		// initialize a collection to hold the updated values
		Collection results = new ArrayList();
		// calculate what it would cost from the no and the price
		double costPrice = 0;
		try {
			costPrice = no * PriceUpdater.price(tickername);
		} catch (Exception e) {
			System.out.println("Invalid tickername. Please try again");
			return null;
		}
		// check if the user has that no of stocks
		int usercount = username.getNoOfStocksByUserAndTickerName(
				username.getUsername(), tickername);
		if (usercount < no) {
			System.out.println("You do not have that no of stocks. You have "
					+ usercount + " " + tickername + " stocks");
			return null;
		}

		// update the userStocks arraylist and write the values to file
		ArrayList<UserStocks> userStocks = DataReader.getUserStocks();
		int index = 0;
		// look for that particular stock being sold and update it
		for (UserStocks us : userStocks) {
			if (us.getTickername().equalsIgnoreCase(tickername)
					&& us.getUsername()
							.equalsIgnoreCase(username.getUsername())) {
				// user already has some of those stocks
				us.setNo(us.getNo() - no);
				userStocks.set(index, us);
				break;
			}
			index++;
		}

		results.add(userStocks); // add the user stocks to the collection. index
		// update and write the no of stocks of the stock
		writeAllUserStocks(userStocks); // write the stock values to the file

		// update and write the no of stocks of the stock
		Stock soldStock = DataReader.getStockByTickername(tickername, stocks);
		int indexOfSoldStock = stocks.indexOf(soldStock);
		soldStock.setNo(soldStock.getNo() + no);
		stocks.set(indexOfSoldStock, soldStock);
		results.add(stocks); // index 1
		writeStockValues(stocks);

		// update the user balance
		int userIndex = DataReader.getIndexOfUser(username, users);
		username.setBalance(username.getBalance() + costPrice);
		username.setUserStock(userStocks);
		users.set(userIndex, username);

		results.add(users); // index 2 is the updated list of all the users
		writeAllUsers(users); // write all the users to file
		results.add(username); // index 3 is the updated value of the user
		// return the collection that was just purchased
		return results;
	}