[Solved] COSC450/550 HW 6

$25

File Name: COSC450/550_HW_6.zip
File Size: 150.72 KB

SKU: [Solved] COSC450/550 HW 6 Category: Tag:
5/5 - (1 vote)

1. Rewrite the following pseudocode segment using a loop structure in the specified language:k = (j + 13) / 27loop:if k > 10 then goto outk = k + 1i = 3 * k 1goto loopout: . . .a. C, C++, Java or C#b. Pythonc. RubyAssume all variables are integer type. Discuss which language, for this code, has the best writability, the best readability, and the best combination of the two.2. Rewrite the following code segment using a multiple-selection statement in the following language:if ((k == 1) || (k == 2)) j = 2 * k 1if ((k == 3) || (k == 5)) j = 3 * k + 1if (k == 4) j = 4 * k 1if ((k == 6) || (k == 7) || (k == 8)) j = k 2a. C, C++, Java or C#b. Pythonc. RubyAssume all variables are integer type. Discuss the relative merits of the use of these languages for this particular code.COSC450/550 HW 63. In a letter to the editor of CACM, Rubin (1987) uses the following code segment as evidence that the readability of some code with gotos is better than the equivalent code without gotos. This code finds the first row of an n by n integer matrix named x that has nothing but zero values.for (i = 1; i <= n; i++) {for (j = 1; j <= n; j++)if (x [i] [j] != 0)goto reject;println ( First all-zero row is : , i);break;reject:}Rewrite this code without gotos in one of the following languages: C, C++, Java, or C#. Compare the readability of your code to that of the example code.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COSC450/550 HW 6
$25