public static ArrayList<LoyaltyProgram> getProgramsForMerchant(Merchant merchant){
       
        SQLiteJDBC db = new SQLiteJDBC();
        ArrayList<LoyaltyProgram> loyaltyPrograms = new ArrayList<LoyaltyProgram>();
        
        String sql = String.format("SELECT id FROM loyalty_programs WHERE merchant ='%d'", merchant.getRegNum());
        ResultSet resultSet = db.query(sql);
        
        try {            
            while(resultSet.next()){
                LoyaltyProgram loyaltyProgram = new LoyaltyProgram(resultSet.getInt("id"));
                loyaltyPrograms.add(loyaltyProgram);
            }
            db.close();            
        }catch(Exception e) {
            System.err.println( e.getClass().getName() + ": " + e.getMessage() );
            System.exit(0);
        }
        
        return loyaltyPrograms;
        
    }