Menu

Problem 6 Note Attempt Solve Problem Covered Design Functions Htdf Design Recipe Lecture D Q43831908

(@problem 6)
;;
;; NOTE: Do not attempt to solve this problem until you havecovered
;; the How to Design Functions (HtDF) design recipe inlecture.
;;
;; Design a function called taller-image that consumes two imagesand produces
;; the image that has the greater height.
;;
;; Note that the template tag for a function that consumes twoimages is:
;;
;; (@template Image)
;;
;; and the template itself is:
;;
;; (define (taller-image i1 i2)
;; (… i1 i2))
;;

;(@htdf taller-image) ;Uncomment this line when you start theproblem.

————————————————————————————————-

I wrote the answer like this

(@htdf taller-image)

(@signature Image Image -> Image)
;; Produces the image that has the greater height given two images  
(check-expect (taller-image (rectangle 2 3 “solid” “red”)
(rectangle 3 2 “solid” “red”))
(rectangle 2 3 “solid” “red”))
(check-expect (taller-image (rectangle 4.2 7.6 “solid” “red”)
(rectangle 7.6 4.2 “solid” “red”))
(rectangle 4.2 7.6 “solid” “red”))
(check-expect (taller-image (rectangle 1 2 “solid” “red”)
(rectangle 2 1 “solid” “red”))
(rectangle 1 2 “solid” “red”))

;(define (taller-image i1 i2 ) empty-image) ;stub

;(define (taller-image i1 i2) ;template
; (… i1 i2))

(@template Image)
(define (taller-image i1 i2)
(if (< (image-height i1) (image-height i2))
i2
i1))

——————————————————————————–

And then I test it

the result says

AUTOGRADING GRADE: 96%.

In (@Problem 6), in (@htdf taller-image), insufficient tests -failed to detect 2 of our buggy functions

what is the correct answer?

Expert Answer


Answer to (@problem 6) ;; ;; NOTE: Do not attempt to solve this problem until you have covered ;; the How to Design Functions (HtD…

OR