At first glance, J.C. Penney (JCPN.Q) and Macy's (M -1.52%) both look like awful investments. J.C. Penney stock plunged more than 40% over the past 12 months, and Macy's stock declined nearly 30%. Both department stores were hit hard by e-commerce competitors and slumping mall traffic over the past few years.

But whenever stocks decline that much, it's worth taking the contrarian view to see if they're close to bottoming out. Let's take a closer look at J.C. Penney and Macy's struggling businesses to see which retailer is more likely to bounce back over the next few years.

A male and female shopper holding shopping bags.

Image source: Getty Images.

How do J.C. Penney and Macy's make money?

J.C. Penney and Macy's both sell a wide variety of merchandise, including apparel, home furnishings, cosmetics, and consumer goods. However, J.C. Penney stores are generally smaller than Macy's stores and sell lower-end products. J.C. Penney also leases out more of its floor space to third-party companies like Sephora, Seattle's Best Coffee, optical centers, portrait studios, and jewelry repair services to boost store traffic.

A JCPenney store in Brooklyn.

Image source: JCPenney.

Macy's has a bank subsidiary, FDS Bank, which provides financial services and credit marketing services for Citigroup's Department Stores National Bank. It also owns the Bloomingdale's chain of department stores and luxury beauty retailer Bluemercury.

J.C. Penney finished fiscal 2016 with 1,013 stores -- a slight decline from 1,021 locations at the end of 2015. Macy's finished last year with 829 stores under its Macy's, Bloomingdale's, and Bluemercury brands, compared to 868 locations at the end of 2015.

How fast are J.C. Penney and Macy's growing?

J.C. Penney's revenue has fallen year-over-year for two straight quarters. The company's revenue dipped by less than 1% last year, but is expected to drop nearly 2% this year. Its comparable store sales, which were flat last year, are expected to remain nearly flat again this year with -1% to 1% growth.

A Macy's store in Rancho Cucamonga, California.

Image source: Macy's.

Macy's revenue has declined year over year for eight straight quarters. Its revenue fell nearly 5% in 2016, and is expected to decline another 4% this year. Comparable-store sales, which fell 3.5% in 2016, are expected to slide another 2.2% to 3.3% this year.

On the bottom line, J.C. Penney returned to profitability in 2016 with a narrow profit of $0.08 per share. Analysts expect that profit to grow nearly sixfold to $0.47 per share this year. Macy's earnings declined 18% to $3.11 per share last year, but aggressive cost-cutting strategies are expected to lift its earnings by 11% this year.

If we compare the two retailers' operating margins over the past five years, we'll notice that J.C. Penney's margins have been improving as Macy's have been falling. Unless Macy's dramatically shifts gears, it could soon report weaker margins than J.C. Penney.

JCP Operating Margin (TTM) Chart

Source: YCharts.

What are the turnaround strategies?

Both retailers are implementing aggressive turnaround strategies. To boost its presence in the internet-resistant home furnishings market, J.C. Penney expanded its home improvement department via new partnerships with Ashley Furniture and Empire Today. To beef up its apparel business, J.C. Penney partnered with Nike to add outlets to 600 of its locations, which complements a related expansion of its Adidas' product offerings.

Last August, Macy's announced that it would close 100 of its stores (15% of its total properties at the time), invest more heavily in its highest-performing locations, and beef up its e-commerce presence. Investors have also been pressuring Macy's to spin off its real estate assets as an REIT (real estate investment trust).

Those moves should sound familiar to Sears Holdings (SHLDQ) investors. When Sears' sales started plunging, it sold off hundreds of stores, promised to invest more heavily in e-commerce, and spun off its real estate assets in an REIT called Seritage Growth Properties. None of those desperate moves saved Sears, and they probably won't fix Macy's core problems, either.

Valuations and dividends

J.C. Penney's trailing P/E is negative due to its inconsistent profitability, but it trades at just 10 times forward earnings. Macy's trades at 15 times earnings and also has a forward P/E of 10. Both stocks are also very cheap relative to their sales growth -- J.C. Penney has an EV/sales ratio of 0.5, while Macy's has a ratio of 0.6.

J.C. Penney hasn't paid a dividend since 2012, but Macy's pays a hefty forward yield of 5.2%, which is supported by a payout ratio of 75%. Macy's has also raised that dividend annually for six straight years.

The winner: J.C. Penney

Macy's dividend looks tempting, but J.C. Penney is simply generating better top- and bottom-line growth with a less desperate turnaround plan. Macy's turnaround strategy lacks the focus of J.C. Penney's efforts to tap into higher growth markets -- like home improvement and athletic apparel -- without aggressive store closures. Therefore, J.C. Penney remains a high-risk play, but I believe it currently has a better shot at a comeback than Macy's.