daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; Constant velocity
  2.  
  3. (let ((velocity 0) (time 0) (displacement 0))
  4.  
  5. (defun velocity-prompt ()
  6.     (setf velocity (or (parse-integer (read-line *query-io*) :junk-allowed t) 0)))
  7. (defun time-prompt ()
  8.     (setf time (or (parse-integer (read-line *query-io*) :junk-allowed t) 0)))
  9.  
  10. (defun displacement-calculation ()
  11.     (setf displacement (* velocity time)))
  12.  
  13. (defun constant-velocity ()
  14.     (format t "What is the velocity of the object?~%")
  15.     (velocity-prompt)
  16.     (format t "For how much time is the object moving?~%")
  17.     (time-prompt)
  18.     (displacement-calculation)
  19.     (format t "The object moved ~d meters in ~d seconds at a constant velocity of ~d m/s." displacement time velocity)))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top