Smoking calculator to show cost of smoking to your health and wealth

20th Sep, 2015 | web personal

A friend of mine recently asked me for my help on adding a spreadsheet to his webpage. I thought it might be a matter of extracting some formatted data into a HTML table but it turned out to be something far more interesting and worthwhile.

He had done research into the costs of smoking and created formula to show the costs of smoking without asking too many questions.

Here’s a preview of the smoking calculator app that allow you to set sliders to show how much smoking can damage both health and bank balance. The figures are compelling.

And the reason to develop this? Well he's a hypnotherapist and helps people overcome difficulties they are facing purely by getting them to understand their issues and getting them to realise ways they can resolve while the mind is in a receptive meditative state.

It is not brainwashing. As the patient is helping themselves they will only act on actions that make sense. Any suggestion too drastic is unlikely to take effect.

One particular area he is finding effective is in helping people who want to quit smoking. Many people find it difficult to stop so hypnotherapy is an effective way to help people quit. However my friend wanted to present people wanting to quit with some hard facts to help them motivate themselves. From this research he developed a simple spreadsheet that accepted basic facts about the patient and presented them with the cost of smoking in the form of both financial cost and cost to health. This was handy to present to clients in sessions to encourage the urge to quit but he wanted in available online so his clients could use the app at any time.

I first put together a bit of basic JavaScript to process form input as you type to produce the figures. It worked quite nicely but lacked that kind of polish we are used to these days on the web.

He originally asked about the possibility of using sliders that are found on price comparison sites. Now the maths side was sorted I thought I should swap them in. I looked at Html5 native sliders but decided browser comparably would be too much of a headache. Plus I always aim for everything I do these days to look good on mobile so I decided to look for a library option. A few google searches later I found myself looking at jQuery mobile demos which ticked all the boxes.

The sliders worked and look good both on desktop and mobile. The formula was plugged in to respond immediately on any change.

It’s a nice little mini app but I doubt it will help on it’s own, if you want support quitting smoking find a local professional to help.