Good afternoon Computer Power Students

ASSIGNMENT Save as: graph_assignment4_lastname

 

**Challenge yourself to race against the clock.  The first 5 students to complete the assignment and have correct answers will earn O$$orio$$ Buck$, save the file as soon as you finish and turn it in.  (Hint: I will check the DrScheme file to see the time and date your work was saved. Don’t save a second time after you have created your graph because it will change the time of your file! )

 

Copy the Cartesian Plan code (in blue) to a new Dr. Scheme file

 

;;=================TEACH PACK COORDINATE PLANE===============

;;--------------------> Canvas Size <---------------------

(define L 400)     ;; Length of Canvas

(define M (/ L 2)) ;; Middle

(start L L)        ;; Starts a drawing canvas

 

;;------------------- > X-AXIS and Y-AXIS <------------------

(draw-solid-line (make-posn M 0) (make-posn M L))

(draw-solid-line (make-posn 0 M) (make-posn L M))

 

;;---------------------> Drawing Commands <---------------------------

;;line: posn posn color -> true

;;Draws a line given the start and end points and a color on a cartesian plane

(define (line start end color)

  (draw-solid-line (make-posn (+ (posn-x start)M) (- M (posn-y start)))

                   (make-posn (+ (posn-x end) M) (- M (posn-y end))) color))

 

;;circle: posn number color -> true

;;Draws a circle given the center point, radius and a color on a cartesian plane

(define (circle center radius color)

  (draw-circle (make-posn (+ M(posn-x center)) (- M (posn-y center))) radius color))

 

;;disk: posn number color -> true

;;Draws a solid-disk given the center point, radius and a color on a cartesian plane

(define (disk center radius color)

  (draw-solid-disk (make-posn (+ M(posn-x center)) (- M (posn-y center))) radius color))

 

;;rect: posn number number color -> true

;;Draws a solid-rectangle given the top-left corner point, the length, width and color

(define (rect corner L H color)

  (draw-solid-rect (make-posn (+ M (posn-x corner)) (- M (posn-y corner))) L H color))

;;=============END OF TEACH PACK COORDINATE PLANE==========|

 

;;--------------------> Grid Line Markers <-----------------
(line (make-posn -5 100) (make-posn +5 100) 'black)
(line (make-posn 100 -5) (make-posn 100 +5) 'blue)
(line (make-posn -5 -100) (make-posn +5 -100)'green)
(line (make-posn -100 -5) (make-posn -100 +5) 'red)

;;-------------------> Clue 4 - Graphing lines <-------------

;;draw TWO LINES
;;The line is parallel to the x-axis
;;The line has a 0 slope
;; The line passes through the point (40, -20)
;;The line intercepts the y-axis at -20
;;The line is perpendicular to the line x = 110 (draw red line)
;;The line passes through the point (-80, -20)
;;
;;
;;Use these clues to draw a line on the coordinate plane.
;;You will use 1-3 draw LINE commands to make a graph of this continuous line
;;You may plot more points along the line, and draw the line segments