780 likes | 1.02k Views
E-Genting Programming Competition 2007. Public Lecture by Jonathan Searcy 15 December 2007. Competition Questions. Air Pollution Monitor. Air Pollution Monitor. Dataflow Diagram. Generating an Image. Text File Format. Reading the Text File. Reading Lines of Input.
E N D
E-Genting Programming Competition 2007 Public Lecture by Jonathan Searcy 15 December 2007
Converting Degrees, Minutes and Seconds into a Simple Scalar Quantity
Scaling the Image Required scale is 1:330,000. This means one inch on the map must correspond to 330,000 inches in the Klang Valley. Tookit.getScreenResolution gives us the screen resolution in pixels per inch, let us call it ‘R’. The inter-pixel distance on the map is 1/R. Therefore the inter-pixel distance in the Klang Valley is 330,000/R inches. The question paper tells us a minute of longitude at the equator is 72913 inches. Therefore the inter-pixel distance in tenths of seconds is (330,000*60*10)/(R*72913). If R is 96, the inter-pixel distance is approximately 28 tenths of a second.
API Status RGB Colour Components Red Green Blue 0-50 Good 0 204 255 51-100 Moderate 0 255 64 101-200 Unhealthy 255 255 0 201-300 Very unhealthy 255 153 0 301-500 Hazardous 255 0 0 Above 500 Emergency 255 255 255 Colour Table
Summary • Using threads and concurrency to display one image while another is being generated. • Reading data from an HTTP server. • Reading fields from a text file. • Unit conversion. • Programming mathematical formulas. • Using the graphical functions of the language and operating system. • Using memory to obtain speed. • Using lookup tables to improve speed. • Using a grid to reduce the volume of data that needs to be processed.
Summary • How to get access to command line parameters from a program. • How to open and read characters from a text file. • How to read and interpret input sequences. • How to use the language or operating system sort functions. • How to emit text to the program’s standard output.