04 Altima Chugging/jerking at any speed

My Altima 2.5S 80,000 miles, has been chugging and jerking almost violently either on the highway or just around town. Also it stalls at stoplights, tachometer seems to be surging at high speed when you coast.

The check engine light was on, my mechanic said the codes were for a crank censor and reflash the computer- dealer stuff. My husband spent$300 and 4 hours at the dealer today, to do those things, and the car chugged on the way home!! If there are no codes to read,nobody knows what to do. anyone have any suggestions??

I find it hard to believe the dealer replaced the crank sensor for $300. It involves a good deal of labor, at least a few hours of labor and whatever a crank sensor costs for a Nissan Altima (which you can and always should research online).
Bring the car back to the dealer. Politely raise hell. Or just raise hell period. They charged you $300 and didn’t fix the problem. It is the dealer’s car and they have the information necessary to diagnose the problem. If nothing else, try to get your money back. If the dealer won’t resolve this issue for you, report the dealership to Nissan (they should care) and the BBB and whatever other online review site you can find.

If they are no help, you can check online review sites to try to find a more competent (or honest) dealer, or bring it back to your mechanic and give him specific things to try to fix the problem, just by changing parts. If you do, start cheap and easy and work from there. First thing, change the inline fuel filter. That actually is fairly likely to be the problem, especially if you have a habit of letting the fuel tank run low before you re-fuel. Next tell him to replace the wires and plugs, unless that has been done recently, and after that, you might try the mass air flow sensor. The part will run around two-hundred but takes very little labor to replace, about five minutes.
Obviously, if my first three suggestions don’t help, it gets more expensive and difficult. The first two you should have done already anyway.
Let your mechanic make suggestions if you trust him or her.
Good luck.