Man shot and killed in attempted burglary