What is the pseudocode output for following inputs?

1) The following function, written in pseudocode, inputs INCOME as a variable and outputs the TAX corresponding to that income. You can think of this…

1) The following function, written in pseudocode, inputs INCOME as a variable and outputs the TAX corresponding to that income. You can think of this as a greatly simplified income tax. 1. IF (INCOME = 90,000) THEN a. TAX ? 14,000 + 0.3 (INCOME – 90,000) 2. ELSE a. IF (INCOME = 40,000) THEN i. TAX ? 4,000 + 0.2 (INCOME – 40,000) b. ELSE i. TAX ? 0.10 INCOME What is the pseudocode output for the following inputs? Explain your solution. a) 27,000 b) 98,000 c) 65,000 This problem is similar to Example 6 and to Exercise 1 in Appendix A of your SNHU MAT230 textbook. 2) Suppose that the array X consists of real numbers X[1], X[2], …, X[N]. Write a pseudocode program to compute the minimum of these numbers. This problem is similar to Example 12 and to Exercises 13–16 in Appendix A of your SNHU MAT230 textbook. 3) Consider the following algorithm; assume N to be a positive integer. 1. X ? 0 2. Y ? 1 3. WHILE (X a. X ? X + 1 b. Y ? Y + 2 X 4. Y ? Y / N Calculate what value of Y the algorithm will compute for the following values of N. Explain your solution. a) N = 3 b) N = 5 This problem is similar to Example 7 and to Exercise 22 in Appendix A of your SNHU MAT230 textbook. 4) Use the Euclidean algorithm to find the greatest common divisor d of 313,626 and 152,346. Then use this algorithm to find integers s and t to write d as 313,626 s + 152,346 t. Solving these types of equations, for much larger integers, is central to encryption schemes such as RSA (public key) encryption. This problem is similar to Examples 5 and 6 and to Exercises 6–9 in Section 1.4 of your SNHU MAT230 textbook.
Let’s block ads! (Why?)

Do you need any assistance with this question?
Send us your paper details now
We’ll find the best professional writer for you!

 



error: Content is protected !!