Debt Clock Debt Clock
home Student Projects no local find frame, full screen Google search web for topic jump to footer translate with Babelfish by Roedy Green ©1996-2008 Canadian Mind Products
This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. It does not describe an actual complete program. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; I have too many other projects of my own.

I do contract work for a living, which could include writing a program such as this. However, 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 any way you please.

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 CO2 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 labelling 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

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.17] The information on this page is for non-military use only.
You are visitor number 11. Military use includes use by defence contractors.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/project/debtclock.html J:\mindprod\project\debtclock.html