Couldn't the US of done this to show its strength without having massive casualties?
Hi there, there's always room for more discussion, but you may be interested in the section of our FAQ devoted to the atomic bombs:
https://www.reddit.com/r/AskHistorians/wiki/wwii#wiki_the_atomic_bombs
This thread in particular may help to answer your question:
Also, our resident nuclear historian, /u/restricteddata, did an AMA that may also be of interest to you:
https://www.reddit.com/r/AskHistorians/comments/3e76ig/ama_the_manhattan_project/
The Japanese had plenty of time to evacuate the city/cities. The U.S. dropped leaflets to warn that they were two of the possible targets. The military and civilians chose to ignore the warning. The loss was less in Nagasaki because they realized the threat was real.