import java.awt.*; import java.applet.*; // /* Compute the number of miles that light will travel in a specified number of days */ public class Light extends Applet { int lightspeed; long days; long seconds; long distance; public void paint(Graphics g) { // approximate speed of light in miles persecond lightspeed = 186000; days = 1000000; //Specify the number of days here. seconds = days * 24 * 60 * 60; //Convert to seconds distance = lightspeed * seconds; //Compute distance g.drawString("In " + days,40,40); g.drawString(" Days light will travel about " + distance + " Miles",100,40); } } /* The program generates the following output: In 1000 days light will travel about 16070400000000 */