Help in merging 2 codes (fixed)

problem is i can't merge the 2 codes together without bunch of errors

Please share your attempt at merging them, the errors it caused and a description of what the combined program should do.