Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Dr. Racket to compute the following expressions. [5 points] (1) 3+5-7 (2) 2* (8+5+4) - 25 (3) 10 ((35)+(2+ (0*5))) (4) 5* (4+
Using Dr. Racket to compute the following expressions. [5 points] (1) 3+5-7 (2) 2* (8+5+4) - 25 (3) 10 ((35)+(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 can use the built-in "-" to define your Subtract procedure. [5 points] 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. (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 built-in division or quotient operators in this procedure definition. [10 points] 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 Square procedure. [5 points] 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. (2) You will need to account for negative values as well. 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. [5 points] 8. Re-implement the procedure (DiffDivide x y) and call it (DiffDivide Let 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 you'd like. [10 points]
Step by Step Solution
★★★★★
3.37 Rating (163 Votes )
There are 3 Steps involved in it
Step: 1
The detailed ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started