for The Duplicate by William Sleator
When David finds a mysterious machine that can copy living things, he thinks his problems are over. Now he can be in two places at once: at his grandmother's and out on a date. While the other David is in school, the real one can spend the day at the beach. The possibilities are endless. And they turn terrifying. David's duplicate has a mind, ideas, and desires of his own--and one of them is to see the real David dead.
Publisher description retrieved from Google Books.