$345 for the tank is about right if it was something more than a 6 year warranty unit. That's a little high for a 6 year model. $300 for labor probably including a permit fee, some fittings, etc. is probalby average to slightly less than the average charge. ( I'm basing this on my area...San Diego) , costs do vary widely from area to area.
You didn't mention if this was gas or electric. Fed. safety standard implemented July 2003, and Federal energy standard implemented Jan 2004 have raised the cost of gas water heaters considerably...50 to 75 %.