FileDocCategorySizeDatePackage
SecondsConversion.javaAPI DocExample1618Thu Sep 14 15:29:12 BST 2000None

SecondsConversion

public class SecondsConversion extends Applet

Fields Summary
private int
seconds
private int
hours
Constructors Summary
Methods Summary
public voidpaint(java.awt.Graphics g)

		seconds  =  17000;				// assign seconds the value 17000
		hours    =  seconds  /  3600; // how many hours are there in 
												// this many seconds?
		g.drawString(seconds + " seconds converts to " + hours + " hour(s) ", 20, 20);
			// now calculate how many seconds are not this number of hours
			// store the result in seconds i.e. overwrite the current value in seconds
			// now calculate how many minutes in this number of seconds
			// store the result in minutes
			// now calculate how many seconds are not in this number of minutes
			// store the result in seconds
			// now print out the number of hours, minutes and seconds.