Question: 1. Using Dr. Racket to compute the following expressions. [5 points] 1.1 19 * 12 + 25 - 33 1.2 15 * ( 16 +

1. Using Dr. Racket to compute the following expressions. [5 points] 1.1 19 * 12 + 25 - 33 1.2 15 * ( 16 + 5 / 3 ) - 12 * 7 1.3 121 * (( 15 - ( 4 * 3 )) + ( 19 / 4 ) ) * 14 1.4 (22 + 33) * ( 21 + ( ( ( 15 / 6 ) + ( 3 * 4 ) ) / ( 5 - 7 ) ) ) 1.5 ( ( ( ( ( ( 6 - 9 ) * ( 11 * 5 + 7 ) ) / 2 ) / 2 ) 5 ) / 3 ) + ( ( ( ( 7 * 5 ) + ( 8 / 2 * 4 ) ) / 2 ) + ( 9 * 5 ) )

2 Bind (define) each value in question 1.5 above to its English text and then change the expression using the defined names. [5 points] For example, the expression 8 + 2 - 10 should be replaced with names eight, two, and ten, and the correct corresponding expression is (eight + two - ten), of course, in prefix notation.

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]

1. Using Dr. Racket to compute the following expressions. [5 points] 1.1

4 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. (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]

19 * 12 + 25 - 33 1.2 15 * ( 16

5 Define a procedure ReadForIntDivide to read the two input values for the IntDivide procedure defined in the previous. This procedure takes no parameters and will pass an input value to the IntDivide procedure. [5 points]

+ 5 / 3 ) - 12 * 7 1.3 121 *

6 Define a recursive procedure called Multiply that will compute the product of x times y. You must implement Multiply procedure by a sequence of additions. [5 points] (1) You can use the built-in + operation, but you cannot use the built-in *. You must recursively use addition to solve the problem. (2) You will need to account for negative values as well.

(( 15 - ( 4 * 3 )) + ( 19 /

7 Define a procedure (DiffDivide x y) that will compute the following expression: x - (x/y)*y. For example, if x = 8 and y = 3, then, 8 (8/3)*3 = 2 You must use Subtract, IntDivide, and Multiply defined in the previous questions. You cannot use the built-in operations -, /, and *. [5 points]

4 ) ) * 14 1.4 (22 + 33) * ( 21

8 Re-implement the procedure (DiffDivide x y) and call it (DiffDivideLet x y). In this procedure, you must use let-form to bind all the procedures used in the definition: Subtract, IntDivide, and Multiply. You may name the local name whatever youd like. [10 points]

+ ( ( ( 15 / 6 ) + ( 3 *

> (Subtract 120 50) 70 > (Subtract 120 50) 70

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!