function result = encodeCaesar(message, shift)
% This function encodes a message using the shift specified
% All non letters are omitted and all letters are shifted to
% upper case.
% assumptions:
% 	message is a String
%     1 <= shift <= 26

numLetters = 0;
zNum = double('Z');
adjustment = 26;
lenMes = length(message);

temp = zeros(1,lenMes);
mes2 = upper(message);

for ch = 1:lenMes
    if( isletter(mes2(ch)) )
        newch = mes2(ch) + shift;
        if (newch > zNum)
            newch = newch - adjustment;
        end
        numLetters = numLetters + 1;
        temp(numLetters) = newch;
    end
end

result = char( temp(1:numLetters));
