package entity;

import boundary.*;
import java.sql.*;

public class StockInfo {
	private String symbol;
	private ResultSet info;
	private double price;
	
	public StockInfo(String symbol) {
		this.symbol = symbol;
	}
	
	public void fetchStockInfo() {
		String query = "SELECT * FROM stock WHERE symbol = " + symbol;
		try {
			info = DatabaseCommunicator.query(query);
			price = Double.valueOf((info.getString("ask")));
		}
		catch (Exception e) {
			System.err.println(e.toString());
		}
	}
	
	public double getPrice() {
		return price;
	}
}
