Mrs. Vang, the cost of replacing a roof depends on what type of house you have and how big is your house. I had mine done couple years ago because of storm damage and cost over $22k. Since I went through my homeowner insurance for storm damage I only pay my $1k deductible xwb. This included my house, attach 3 car garages and shed. Plus my house is also a 2 story house too.
Yes, you can do it yourself for a cheaper price because you’re doing all the labor and if your house is smaller the mine; it would be cheaper as well. For a rambler/ranch home at 2k square feet house, if you do if yourself it would cost between 2-4k xwb no including manual labor. What you have to do is, pay for a permit with the city you live in, once you’re finish with your new roof, call the city, they'll re-inspect the roof and you are set.
If you hire a contractor, they will pull the permit for the roof replacement and you wouldn't have to do anything. For most contractors, you have to pay half up front. When they finish the job, it must be paid in full.
I hope this helps.