I just did the trip you are talking about. I had a bit more time. About 6 weeks.. You can do it, it just depends on what your goals are. If you just do Amman you can be there really for a day. If you want to do the Desert castles that is whole day. It is a small country and easy to get around. You could do Amman 2 days. Then an option would be to cross into Israel and go to Jerasalem for a few days then back into Jordan and then down to Masada and the dead sea, mount nebo, and that you can do in 3 days, then head down to Petra for 2 days. Then you can see a good portion of both countries.
You need your egypt Visa to go to Cairo but you can cross into Egypt at Taba, then head down to Dahab for a few days. From there head out to Cario and see the sites.. If you send me a message I will be more than happy to answer anything specific. Places to stay, sites, timetables, anything like that.. If you give me a bit more information it will be easier to figure out an itinerary..