You would need 3 days in Beijing to see the sights.
Shanghai you would need 4 days. Well worth taking a day trip to Tongli in Jiangsu Province whilst in Shanghai.
Hong Kong you would need 2 days here. Be aware that Hong Kong is quite expensive and you will need $250 per day just to survive.
Doing Tours will take the stress out of getting lost and the language barrier, but will be more expensive than doing it yourself.
You can get an Overnight sleeper train from Beijing to Shanghai for about Y500. It takes 12 hours. And you save money on accommodation!
Shanghai to Hong Kong you will probably be best to fly.
It will cost about $1200 to fly from HK back to Beijing.
If you want to climb a mountain come to Tai'an and climb Tai Shan. It is the most revered of China's 5 sacred Taoist peaks. You need to allow yourself 8 hours for a round trip.
You could go from Beijing to Taishan by Train. It is 6 hours and will cost about Y80.
You could then take the overnight train from Taishan to Shanghai. It's an 8 hour journey and the sleeper will cost about Y250.