INTEGER B, BONCES, START REAL STR(40) C Time of each bounce and starting velocity REAL BTIME(21), VEL(21) C Plot points. 201 are data last two used by PSCALE REAL X(203) REAL Y(203) C Simulate ball thrown up from floor at specific velocity 90 WRITE(4, 100) 100 FORMAT(' ENTER INITIAL BALL VELOCITY FROM 5 TO 100 FEET/SECOND ' C ,$) READ(4,110) V 110 FORMAT(F9.0) IF (V .GT. 100) GO TO 90 IF (V .LT. 5) GO TO 90 WRITE(4, 120) 120 FORMAT(' LARGER VALUES ARE MORE BOUNCY') 125 WRITE(4, 130) 130 FORMAT(' ENTER COEFFICIENT OF RESTITUTION BETWEEN 0 AND 1 ',$) C In FORTRAN the number of digits is implied decimal point location C non specified so use .0 even if number has decimal point READ(4,110) E IF (E .GE. 1) GO TO 125 IF (E .LE. 0) GO TO 125 WRITE(4, 150) 150 FORMAT(' ENTER NAME ',$) READ(4,160) STR 160 FORMAT(40A1) SLEN = 40 C Get length of string. Array padded with space. DO 165 I=1,SLEN 165 IF (STR(I) .NE. ' ') SLEN = I C Find how many bounces to be less than .1 of initial velocity. Round C to next larger integer 200 BONCES = INT(ALOG(.1)/ALOG(E) + .99999) C Limit bounces to 50 to 20 IF (BONCES .LT. 5) BONCES = 5 IF (BONCES .GT. 20) BONCES = 20 C Gravity acceleration G = -32.174 BTIME(1) = 0 VEL(1) = V C Calculate time for each bounce DO 290 I=1,BONCES BTIME(I+1) = BTIME(I) - 2 * VEL(I) / G 290 VEL(I+1) = VEL(I) * E N = 0 C Plot 10 points in each bounce DO 350 I=1,BONCES STEP = (BTIME(I+1) - BTIME(I)) / 10 C .99 to make sure we get the last point with float errors DO 350 T= 0, BTIME(I+1) - BTIME(I) - STEP*.99, STEP N = N + 1 X(N) = BTIME(I) + T Y(N) = VEL(I)*T + G * T * T / 2.0 C WRITE (4,340) N,STEP,X(N),Y(N) C340 FORMAT(I4,F6.3,F9.3,F9.3) 350 CONTINUE C Add last point to plot N = N + 1 T = BTIME(BONCES+1) X(N) = BTIME(BONCES+1) Y(N) = 0 C Size of axis YLEN = 7.1 XLEN = 9.2 C Title text size SYMSZ = .175 C Center name START = (XLEN / SYMSZ - SLEN) / 2. IF (START .LT. 0) START = 0 CALL PLOTS(.005, 0) CALL PSCALE(X, XLEN, N, 1) WRITE (4, 999) N, X(N+1), X(N+2) 999 FORMAT(I4,F9.3,F9.3) CALL AXIS(0., 0., 'TIME IN SECONDS', -15, XLEN, 0., X(N+1), C X(N+2)) CALL PSCALE(Y, YLEN, N, 1) WRITE (4, 999) N, Y(N+1), Y(N+2) CALL AXIS(0., 0., 'HEIGHT IN FEET', 14, YLEN, 90., Y(N+1), Y(N+2)) CALL LINE(X, Y, N, 1, 0, 100) C Plot name and title DO 400 I = 1, SLEN 400 CALL SYMBOL((I+START)*SYMSZ, YLEN-.2, SYMSZ, STR(I), 0, 1) CALL SYMBOL(5*SYMSZ, YLEN-.5, SYMSZ, 'MOTION FOR V0 = ', 0, 16) CALL WHERE(XLOC, YLOC, F) CALL NUMBER(XLOC, YLEN-.5, SYMSZ, V, 0, 2) CALL WHERE(XLOC, YLOC, F) CALL SYMBOL(XLOC, YLEN-.5, SYMSZ, ' RESTITUTION = ', 0, 15) CALL WHERE(XLOC, YLOC, F) CALL NUMBER(XLOC, YLEN-.5, SYMSZ, E, 0, 2) CALL PLEXIT END