you don't have to take a course in order to write the D and Z tests, nor do you need a course to do the road tests after you pass the written portions. it's probably a good idea, though, since you get to know the tips and tricks. the hard part is finding a reasonably-priced course to take... check in the phone book, maybe some google-searching for your area, and do a bit of research to find the best deal.
as has been said, the A class needs a medical every couple years, which at over $100 a pop, adds up fast. if you're not planning on driving a tractor-trailer, don't bother with the A... you don't gain anything by it, other than bills. a D class will let you drive fire trucks, so go with that (free advice there, you get what you pay for).
check out local community colleges, they usually run DZ programs on weekends for not toooooo much money.