General: Work within this document for your homework, and be sure to show all st
ID: 3007206 • Letter: G
Question
General:
Work within this document for your homework, and be sure to show all steps for arriving at your solution.
Appendix A Homework
1) The following function written in pseudocode accepts INCOME as a variable and outputs the TAX corresponding to that income.
FUNCTION TAX (INCOME)
1. IF (INCOME > 60000) THEN
a. TAXDUE 15000
2. ELSE
a. IF (INCOME > 30000) THEN
1. TAXDUE 5000
b. ELSE
1. TAXDUE INCOME × 0.08
3. RETURN (TAXDUE)
What would the pseudocode output with an input of:
a) 23000?
b) 64000?
c) 47000?
This problem is similar to example 6 and problem A.1.
2) Suppose that the array X consists of real numbers X[1], X[2], the array Y consists of the real numbers Y[1], Y[2], and the array Z consists of the real numbers Z[1], Z[2]. What does the following algorithm compute?
1. LSUM 0
2. FOR I = 1 THRU 2
a. LSUM LSUM + (X[I])(Y[I])(Z[I])
This problem is similar to problem A.5.
3) Consider the following algorithm; assume N to be a positive integer.
1. X 0
2. Y 0
3. WHILE (X < N)
a. X X+2
b. Y Y+X
4. Y Y/N
What will this algorithm compute when N = 2? N = 5? This problem is similar to example 7.
Section 1.4 Homework
1) Write m as qn+r, with 0 < r < n for parts a) through c).
m = 75, n = 13
m = 13, n = 75
m = 44, n = 11
This problem is similar to example 1 and problems 1.4.1–1.4.4.
2) Write the integer as a product of powers of primes.
179
244
This problem is similar to example 3 and problem 1.4.5.
3) Find the greatest common divisor d of the integers 58 and 124, and write d as s(58) + t(124). Write out all of the steps. This problem is similar to examples 5 and 6 and problems 1.4.6–1.4.9.
4) Use the fact that GCD(a,b)•LCM(a,b)=ab to compute the least common multiple of 58 and 124, LCM(58,124). This problem is similar to problems 1.4.10–1.4.13.
5) If f is the mod-5 function, compute each of the following:
f(13) + f(19)
f(13+19)
f(278)
This problem is similar to example 9 and problems 1.4.16–1.4.17.
6) Use Bacon’s code to create a dummy message for ABANDON. For the sake of simplicity, use bold font for 0 and regular font for 1. This problem is similar to examples 15 and 16 and problem 1.4.45.
Section 2.4 Homework
1) Prove that
Here is a general outline you can use.
Basis step. Prove P(1)
Induction step.
Write out P(k) by replacing “n” with “k” in the original equation.
Now, we must look at P(k+1). To do this, modify your P(k) expression from part 2a by adding the “k+1”st term to the left hand side and replace “k” with “k+1” on the right hand side. This is what we need to show.
Using the assumption that P(k) is true, replace the “1 through k” portion on the left hand side of the P(k+1) equation you wrote in part 2b.
If necessary, multiply away any constant denominators in the new P(k+1) formulation.
Multiply out the left-hand side and the right-hand side to establish the equality.
This problem is similar to problems 2.4.1, 2.4.2, and 2.4.4.
Explanation / Answer
note : only one question allowed per submission
1. a income = 23000
tax due therefore = 23,000 *0.8 = 18400
b.income = 64000
tax due therefore = 15,000
c.
income = 47000
tax due therefore = 5,000
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.