Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

; Your name here ; CSE240 hw11 ; Q1 (5 points) (- (+ 1 2) 4) ; example ; Q2 (5 points) (define three 3)

image text in transcribed

image text in transcribed

; Your name here ; CSE240 hw11

; Q1 (5 points) (- (+ 1 2) 4) ; example

; Q2 (5 points) (define three 3)

; Q3 (5 points) (define Subtract (lambda (x y)

(Subtract 5 2) ; test case

; Q4 (10 points) (define IntDivide (lambda (x y)

(IntDivide 18 4); test case

; Q5 (5 points) (define ReadForIntDivide (lambda()

(ReadForIntDivide); test case

; Q6 (5 points) (define Multiply (lambda (x y)

(Multiply 4 7); test case

; Q7 (10 points) (define DiffDivide (lambda (x y)

(DiffDivide 8 3); test case

; Q8 (5 points) (define DiffDivideLet (lambda (x y)

(DiffDivideLet 8 3); test case

Programming Exercise (50 points) In this assignment, you will be learning Scheme through the use of Dr. Racket. We would like to start with some basic concepts; trying to under prefix notation and the use procedure in Scheme. You will also implement nested procedures and recursive procedures. You may only use the procedures shown in the text and slides - not any of the additional library procedures in Scheme 1. Using Dr. Racket to compute the following expressions [5 points] 1.1 19 1225 33 1.2 15(16+5/3)-127 1.3 121(15 (4 3)(19/4))* 14 1.4 (2233)* (21((15/6) (3 4))(5-7))) 2 Bind (define) each value in question 1.5 above to its' English text and then change the expression using the defined names For example, the expression 82 10 should be replaced with names eight, two, and ten, and the correct corresponding expression is (eight+ two - ten), of course, in prefix notation [5 points] 3 Define a procedure called "Subtract" that takes two parameters and returns the difference of them You can use the built-in "-" to define your Subtract procedure [5 points] (Subtract 120 50) 70 Define a recursive procedure called "IntDivide" that will compute the quotient of x divided by y You must implement IntDivide procedure by a sequence of "Subtract" procedures that you defined in question 3. You may not use the built-in division or quotient procedures in Scheme 4 (1) You must recursion to implement the iteration (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 built-in division or quotient operators in this procedure definition [10 points] (IntDivide 8 3) > (IntDivide 8-3) Programming Exercise (50 points) In this assignment, you will be learning Scheme through the use of Dr. Racket. We would like to start with some basic concepts; trying to under prefix notation and the use procedure in Scheme. You will also implement nested procedures and recursive procedures. You may only use the procedures shown in the text and slides - not any of the additional library procedures in Scheme 1. Using Dr. Racket to compute the following expressions [5 points] 1.1 19 1225 33 1.2 15(16+5/3)-127 1.3 121(15 (4 3)(19/4))* 14 1.4 (2233)* (21((15/6) (3 4))(5-7))) 2 Bind (define) each value in question 1.5 above to its' English text and then change the expression using the defined names For example, the expression 82 10 should be replaced with names eight, two, and ten, and the correct corresponding expression is (eight+ two - ten), of course, in prefix notation [5 points] 3 Define a procedure called "Subtract" that takes two parameters and returns the difference of them You can use the built-in "-" to define your Subtract procedure [5 points] (Subtract 120 50) 70 Define a recursive procedure called "IntDivide" that will compute the quotient of x divided by y You must implement IntDivide procedure by a sequence of "Subtract" procedures that you defined in question 3. You may not use the built-in division or quotient procedures in Scheme 4 (1) You must recursion to implement the iteration (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 built-in division or quotient operators in this procedure definition [10 points] (IntDivide 8 3) > (IntDivide 8-3)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

7-5 How will MIS help my career?

Answered: 1 week ago