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 = …….
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); } }