If you always drive your car in the same manner then sure, you'll probably have a reasonable estimate. But similarly if all you do with your computer is browse the web, you'll also have a predictable battery remaining estimate. But while many people do drive fairly consistently, your usage of your computer probably has a lot more variety in terms of energy impact.
Even my model year 2000 clunker has instant MPG, average MPG, miles to empty and a gas gauge with actual gallons.
Such a style is cheaper to implement. Resistive float sensor in the tank, run a wire to a mini 90 degree needle gauge in the instrument cluster, done. Instant/Average MPG and miles to empty are additional fanciness that up until recently, came standard only on higher-end cars, or was part of an optional package that may or may not be avail on lower end brands/models.
Everything else (1998 Toyota Camry, 2002 Chevy Impala, 1997 Ford Ranger, 2005 VW GTI) have only had an analog fuel gauge.
Using your analogy, your gas gauge doesn't show the number of gallons, it shows a relative level.