Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please use Scheme to solve!! [5 points] 1. Using Dr. Racket to compute the follo

ID: 3814262 • Letter: P

Question

Please use Scheme to solve!!

[5 points] 1. Using Dr. Racket to compute the following expressions. (1) 3 5 7 (2) 2 8 5 4 25 (3) 10 3* 5) (2 +(0* 5))) (4) 5 (4 (((10 10 5 8 10 2 (5) ((((((3+5) (6+ 4)) /2)/2)-5)/3) ((((2 10) 5* 4))/ 2) 4 5) 2. Bind (define) each value in 1.5 above to its' English text and then change the expression using the defined names. 5 points For example, the values in 1.1 should be replaced with names three, five, and seven, and the correct corresponding expression is (eight two ten) 3. Define a procedure "Subtract" that takes parameters and returns the difference of them You [5 points] can use the built-in to define your Subtract procedure. (Subtract 120 50) 70 4. Define a recursive procedure called "IntDivide" that will compute the quotient of x divided by y You must implement Int procedure by a sequence of Subtract procedures (1) You must use the Subtract procedure defined above. (2) You will need to account for negative values as well. Hint: This will require a conditional and possibly the (abs x) procedure. You may not use the [10 points] built-in division or quotient operators in this procedure definition. (Int Divide 8 3)

Explanation / Answer

;1. 3+5-7
;(+ a b) means it returns a+b value
(- (+ 3 5) 7)
;2. 2*(8+5+4)-25
;BODMAS rule i.e frst Bracket of,Division,Multpctn,addtn,Subtrcn order
(- (* 2 (+ 8 5 4) ) 25)
;3. 10-((3*5)+(2+(0*5)))
;bracket evaltn and finaly subtrcct
(- 10 (+ (+ (* 0 5) 2) (* 3 5)))
;4. 5*(4+(((10+10)+(5*8))/(10+2)))
;first simplyfy inner bracket (10+10)+(5*8)) an then divide ; with (10+2)then add 4 and mul 5
(* 5 (+ 4 (/ (+(+ 10 10) (* 5 8)) (+ 10 2))))
;5 ((((((3+5)*(6+4))/2)/2)-5)/3)+
;((((2*10)+(5*4))/2)+(4*5))
;first simplfy two lft ad rght brackets and add both
;Follow BODMAS
; first left (/ (- (/ (/ (* (+ 3 5) (+ 6 4)) 2) 2) 5) 3)
; right brackt (+ (/ (+ (* 2 10) (* 5 4)) 2) (* 4 5)) ;add both

(+ (/ (- (/ (/ (* (+ 3 5) (+ 6 4)) 2) 2) 5) 3) (+ (/ (+ (* 2 10) (* 5 4)) 2) (* 4 5))

3.(define (Subtract num1 num2)
   (- num1 num2))
(+ (/ (- (/ (/ (* (+ 3 5) (+ 6 4)) 2) 2) 5) 3) (+ (/ (+ (* 2 10) (* 5 4)) 2) (* 4 5)) )