How much does it cost to run gas water heater?
Figuring cost ACCURATELY is a considerable task: Age, type of gas, cost of local gas supply, elevation above sea level, incoming air supply, efficiency, efficiency decline over time, etc play a roile in calculation.

General formula:
1 BTU will raise 1 gallon of water by 1F at sea level
Higher altitude requires more BTU because there is less oxygen per cu foot of air.
Each water heater has a BTU rating, based on new heater under ideal conditions rarely attainable in real world, even right out of the box, just like the gas milage advertised for your new car never quite adds up, the water heater does not reach the effeciency number shown on the manufacturer's sec sheet. Why? Probably because the industry self-tests it's own products, and product sellers want to show their product in best light.
So misleading facts from manufactures can affect actual cost of fuel consumption.

New energy standards in 2015.
The government mandated new energy standards beginning April 2015 that affect all appliances. The 'conservatives' did NOT yell about it despite support of gobbling up the world as fast as possible, yet somehow the 'liberal' concept of conserving resources and regulation is now in effect. Probably because economic growth cannot be sustained without conserving resources.
Does that mean conservation won? ... oh no, because the new heaters are more expensive to buy and install, and over-55 gallon heaters require expensive high technology and service technicians for repair and maintenance. The tanklesss was not affected by the new standard. And besides, the industry decides what to say about their own product's energy compliance, and external factors such as price, installation, longevity and maintenance were never considered as an energy extense., except all costs are energy.
New-energy-standards-for-water-heaters-DOE 2015-article.pdf

Question: do most folks have new higher efficiency water heater in 2017? Answer: No.
How many old heaters are still out there? I don't know. Average lifespan of heater 10-25 years maybe, so the pile of old heaters will eventually be whittled down.
The industry sells 250 K newwater heaters per month.

 and age of heater, and heater maintenance are factors.
Older heaters get dirty and combustion efficiency drops.
Efficiency affects the consumption of fuel, and of course affects energy calculation.
Your app would need to show relative efficiency range from low 62% to 67% for tank type heaters. Tankless gas claims a high efficiency rating of 82% under ideal conditions, but efficiency drops over time as scale builds up inside combustion chamber. Condensing gas water heaters show 86% efficiency.

Type of gas varies in price: propane burns hotter and produces more BTU than natural gas, but is more expensive than natural gas.
Gas prices vary on the commodity market and can fluctuate by seasonal as furnaces raise demand in winter.

Gas water heaters with power vent or flue damper consume 120 volt to operate flue damper or power vent, so the cost of electric is a consideration.

Simply showing approximate cost of fuel does not take into consideration the cost of the heater. So condensing gas shows 86% efficiency but the cost for this is misleading because of the increased cost of maintenance and repair for high tech heaters.

Heating oil is considered the least efficient way to heat, and I don't know anything about it beyond that.