Is it reasonable to travel to Beijing and Shanghai in 2 weeks?

14 days to Beijing and Shanghai is totally enough. And also, it will be a tour including all the highlights in both cities.

Generally, Beijing is for 5-6 days covering all the must-see attractions in Beijing. 8-9 days will be a loose tour with lots of time to experience the local lifestyle in Beijing.
beijing tour
Here are the general Beijing day tour arrangements:
1 day Forbidden City, Tian'anmen Square, Temple of Heaven, Jingshan Park
1 day Great Wall tour, Olympic sites to Bird's Nest Stadium and the Water Cube
1 day Summer palace and Yonghe palace
1 day Hutong tour and shopping
And also there are some parks in Beijing for you to pick out as a day tour.
If you plan to visit Beijing in Sep. or Oct., recommend to pay a visit to Fragrant Hill Park to see the red leave
Need to see more about Beijing itineraries, click Beijing tours for your reference. 

And Shanghai for 4-5 days is reasonable. You may visit to the main attractions in Shanghai, or take extension tour to nearby Suzhou or Hangzhou.
 
Shanghai tour
Here are the general Shanghai day tour arrangements:
1 day Yuyuan Garden, Jade Buddha Temple, Shanghai World Financial Center, the Bund and Nanjing Road
1 day Zhujiajiao Water Town
1 day to Suzhou or Hangzhou
While also recommend you to visit Suzhou or Hangzhou from Shanghai. These two cities with the typical scenery of the southern Yangtze River region.
Need to see more about Shanghai itineraries, click Shanghai tours for your reference.