Here are some clear instructions on replacing a failed 3850 stack member (switch 4 in this case) and upgrading the 3850 stack as well.
First, go get the latest recommended image as of 5/1/2018
download link:
https://upw.io/2Ve/cat3k_caa-universalk9.16.03.06.SPA.bin
1. Take full backup of switch stack
2. Upgrade stack and new switch (separately) to latest image as provided above
3. Verify upgrade went okay
4. Renumber and change priority of the new switch via it’s config to match the failed member (do this on new switch) and save it or else it can wipe stack
switch X provision Z switch X priority 1 copy run start !X is the slot for the switch in the stack !Z is the type of switch model
5. Power down new switch and rack it
6. Connect stack cables from stack to new switch
7. Connect power cables for new switch
8. At this point we should be complete