creating and testing charge conservation code in charge.cpp