functions.rkt (CS 135 Assignment 1)

The instructions for this code is located here.

#lang racket

; defines a function with parameters radius, r, and height, h
; and returns the volume of a cylinder according to those parameters
(define (cylinder-volume r h) 
    (* pi (sqr r) h))

; defines a function with paramters:
; principal amount, p
; compound interest rate, r, after terms, t
; returns the future value according to those parameters
(define (future-value p r t)
  (* p (expt (+ 1 r) t)))

; defines a constant, g, which is the acceleration due to gravity (equal to 9.8 m/s^2)
(define g 9.8)

; defines function with parameters velocity, v, after time, t
; and returns the height of an object thrown straight up according to those parameters
(define (height v t)
  (- (* v t) (/ (* g (sqr t)) 2)))

            Created: October 3, 2014
Completed in full by: Michael Yaworski