May 26, 2005

Hello world

Posted by Scott at 09:36 PM

Gas costs - When one is learning to program in a given language, you typically write a simple program often known as the "Hello World" program. Last week I bought a pair of books on Javascript and DHTML. These are two web technologies that enable web pages to update themselves without intervention from the remote web server. The webnotes and about pages use a lot of it. All computation and updating happens within the visitor's browser.

I was debating what my "Hello World" would be. I was thinking about how much people obsess about the cost of gas. While I admire concern for reducing emissions and dependency on foreign oil (and fossil fuels in general), I've often thought that fuel costs are a small percentage of the cost of using a car per month (or per mile, take your pick). So I decided to write a bit of code to dynamically compute that on the viewer's web browser. It's not finished yet so it may have some hiccups, but I'll polish it over the next couple of days. In particular I want to add a section that computes cost per mile.

In order for the form below to work, you must have Javascript enabled in your web browser. Most browsers have it enabled by default. To use the form, just edit any of the fields above the "Compute" button. I based some of the default values below on my 1998 Honda Accord EX-V6 (a cheapskate's Acura), as if I were going to sell it now. Note at the bottom it shows what happens to your overall costs every time gas goes up a dime. I was also thinking about computing what happens if somehow you were able to magically double your miles per gallon, since everyone is into hybrids these days. Just like gas price hikes, the impact isn't that big. There's numerous numbers games your could play with once you get the initial values in.

In my case insurance is cheap (I'm married, with children, in my late 30's, no insurance claims in over a decade and a half) but annual maintenance on the car is going up due to its age. My car is no econobox, fuel efficiency-wise, but it's not a Hummer H2. It seems to me that fluctuations in gas prices are insignificant compared to the impact of holding onto your car an extra year or two. People always seem to think that high gas prices really shaft the owners of monster SUVs, but their primary source of hurt is just the cost of the vehicle, especially if their vanity keeps them buying new ones every few years. High gas costs just put a little salt on their wounds.

Enter Car Information:
1) Enter value of car when purchased:
2) Enter how long you think you'll own the car in years:
3) Enter what you think it's value will be at tradein:
4) Enter annual insurance costs:
5) Enter annual maintenance costs:
5) Enter annual mileage:
6) Enter typical miles per gallon:
7) Enter cost of a gallon of gas:
Monthly cost information
10) Each month the car costs you:
(just due to change in value)
11) Each month the car costs you:
(from insurance)
12) Each month the car costs you:
(from maintenance)
13) Each month the car costs you:
(from in gas)
14) Each month the car costs you:
(totaling the above)
15) Percentage that is fuel
16) Monthly gas cost if
gas goes up a dime
17) Total monthly cost if
gas goes up a dime
18) Percentage increase
Comments

Hah, I remember those "Hello World" programs. Had to do them for my C++,VB and Java classes.

Posted by: CHris at May 28, 2005 06:40 AM

I don't know if you tried that "Hello World" link at Wikipedia. If you scroll down a bit it had lots of examples of "Hello World" in a variety of computer languages.

http://en.wikipedia.org/wiki/Hello_world

Posted by: Scott at May 28, 2005 06:51 AM