The Hartford Whalers were sold Wednesday night for $47.5 million to two Michigan computer company executives who intend to keep the team in Hartford for at least four years. The purchasers, Peter Karmanos and Thomas Thewes, are the principal owners of Compuware Corp. They have been seeking an NHL franchise for years.