View Single Post
Old 10-07-2007, 07:04 AM   #27
opelayday

Join Date
Oct 2005
Posts
537
Senior Member
Default
Thats exactly it. He didn't give enough info to determine if the stretching effects the worms position. And take a look at the sample output he provided:

Code:
Code
Sample Output Day = 0 Million.   Distance from end = 0 Million meters. Day = 1 Million.   Distance from end = 19 Million meters. Day = 2 Million.   Distance from end = 30 Million meters. Day = 3 Million.   Distance from end = 39 Million meters. Day = 4 Million.   Distance from end = 45 Million meters. Day = 5 Million.   Distance from end = 49 Million meters.  …….  When the worm crawls 6 meters per day: the worm reaches the end of the rope on day = …….

and he gave us this code to start:

Code:
Code
public class Worm {   public static int DISTANCEPERDAY = 6;   public static void main(String[]arg) {     double ropeLength = 100;      double distanceFromStart = 0;     double distanceFromEnd = ropeLength;      int day = 0;     while (…………………………………..) {      }      System.out.println("When the worm crawls " + DISTANCEPERDAY +        " meters per day:");           System.out.println("the worm reaches the end of the rope on day = " + day);  } }

Looking at he output only proves that the worm will never reach the end...
opelayday is offline


 

All times are GMT +1. The time now is 07:29 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Design & Developed by Amodity.com
Copyright© Amodity