image provider

Debt Clock


Disclaimer

This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

Introduction

Have a look at the TIPs US National Debt clock. It shows how fast the USA is going into debt, updates several times a second. It also shows each family’s share of the debt. It shows the current fiscal year spending. It shows spending since the Applet started.

It would be nice to have pretty Swing version of this Applet you can configure for use as a clock for any country, just by providing <params for them.

You might make it even more generic, by providing parameters for frantically updating versions of population clocks like the US population clock.

After you got that working, you might make it more general still to use for any sort of counter such as cost of a war, amount of CO₂ in the air, number of electric cars on the road… The idea is to allow non-programmers to illustrate all manner of changing numerical facts about our universe on their website. You could get very flexible, giving the user the ability to configure each line of the display with labeling text, value, formatting, font, size, colours, formula.

Perhaps a simpler approach would be to just write several well-commented Applets, theme and variations, then even beginner programmers could modify them to their heart’s content without complicated parameters.

Implementation

Use a java.swing.Timer to update the display every 0.1 second. Get the time in milliseconds since 1970 with System. currentTimeMillis. You then need to do a little math to take the statics you can gather and convert them to a linear equation of the form value = timeInMillis * slope + intercept;

If you have a numerical analysis background, you might provide as parameters a set of dates and corresponding values and have the program discover the magic constants for a nth order rounded interpolation (e.g. Chebychev polynomials or spline curves). Though this would be much more difficult for you, it would be much easier for your users to configure.

Calendar
Timer

This page is posted
on the web at:

http://mindprod.com/project/debtclock.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\project\debtclock.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[18.224.59.138]
You are visitor number