@SuppressWarnings("resource")
	public int getEmptySeats(String cabinClass, int fsID, int cap) {
		
		int free = 0;
		
		try {
		
			Connection conn = DBConnection.getConnection();
			
			String sqlStr = "select * from booking b where b.fsID=?";
			PreparedStatement pstmt = conn.prepareStatement(sqlStr);
			
			pstmt.setInt(1, fsID);
			ResultSet rs = pstmt.executeQuery();
			
			// If there are bookings for the fsID
			if (rs.isBeforeFirst()) {
				
				if (cabinClass.equals("Economy")) {
					
					sqlStr = "select sum(economy) as sum from booking b where b.fsID=?";
					pstmt = conn.prepareStatement(sqlStr);
					
					pstmt.setInt(1, fsID);
					rs = pstmt.executeQuery();
					
					while (rs.next()) {
						int taken = rs.getInt("sum");
						free = cap - taken;
					}
										
				} else if (cabinClass.equals("Business")) {
					
					sqlStr = "select sum(business) as sum from booking b where b.fsID=?";
					pstmt = conn.prepareStatement(sqlStr);
					
					pstmt.setInt(1, fsID);
					rs = pstmt.executeQuery();
					
					while (rs.next()) {
						int taken = rs.getInt("sum");
						free = cap - taken;
					}
					
					
										
				} else if (cabinClass.equals("First")) {
					
					sqlStr = "select sum(first) as sum from booking b where b.fsID=?";
					pstmt = conn.prepareStatement(sqlStr);
					
					pstmt.setInt(1, fsID);
					rs = pstmt.executeQuery();
					
					while (rs.next()) {
						int taken = rs.getInt("sum");
						free = cap - taken;
					}
										
				} 
				
				conn.close();
				
			} else {
				free = cap;
			}
			
		} catch (Exception e) {
			System.out.println("getEmptySeats() - " + e);
		}
				
		return free;
		
	}