Question: Number your problem answers clearly, such as Problem ( 1 . a ) , ( 1 . b ) , ( 1 . c )

Number your problem answers clearly, such as Problem (1.a),(1.b),(1.c),(1.d),(1.e), Problem 2,
Problem (2.a),(2.b),...,(4.d), and arrange the answers to the problems in order. Use only a
Word file (.docx) to answer the questions; PDF files will be graded without feedback. Failure to
use a Word file will result in non-feedback or a deduction of 10 points.
If you attach a PDF page in your Word file for solutions, please leave a few lines blank after
your solution page to allow for comments. You will not get any feedback if there is difficulty.
The total number of points for this assignment, As01, is 60.
You can use only logical operators, relational operators, boolean expressions, if, if-else, if-elseif, nest-if, and while statements. You can use statements to input x and y and output their
quotient and remainder.
1.[20 pts.] Extend the iterative version of the division function division(x, y) to compute
x/y using the addition operator, where x and y are integers, and the output is x = q * y + r,
q and r are integers. Write a program to compute x/y iteratively. (For credits, please copy
and paste your program into a Word file) for submission. You also need to submit your
program, which allows us to execute it with another set of inputs.)
2.[20 pts.] To improve the iterative version, write a recursive function division(x, y) to
compute x/y using the addition operator, where x and y are integers, and the output is x =
q * y + r, q, and r are integers. Write a program to compute x/y iteratively. (For credits,
please copy and paste your program into a Word file) for submission. You also need to
submit your program, which allows us to execute it with another set of inputs.)
3.[10 pts.] For problem 1, what is your input size? How many iterations do you need to
compute x/y? Justify your solutions.
4.[10 pts.] For problem 2. What is your input size? How many recursive calls do you need
to compute x/y? Justify your solutions.
Your test data will be the following set {(X, Y)}. Your output should be as follows: x = q*y + r.

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!