software development Chapter 5 Homework Write a pseudocode solution for each of these problems. 1. Design a While loop that lets that user enter a numbe

Chapter 5 Homework

Write a pseudocode solution for each of these problems.

1. Design a While loop that lets that user enter a number. The number should be multiplied by 10, and the result stored in a variable named product. The loop should iterate as long as product contains a value less than 100.

2. Design a Do-While loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat; otherwise it should terminate.

3. Design a For loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 ….. 100.

4. Design a nested loop that displays 10 rows of # characters. There should be 15 # characters in each row.

5. Convert this For loop to a While loop.

Declare Integer count

For count = 1 to 50

Display count

End For

6. Find the error in the following pseudocode.

Declare Boolean finished = False

Declare Integer value, cube

While NOT finished

Display “Enter a value to be cubed.”

Input value;

Set cube = value ^ 3

Display value, “ cubed is “, cube

End While

7. The programmer intended the following pseudocode to display the numbers 1 through 60, and then display the message “Time’s up!” It will not function as intended, however. Find the error.

Declare Integer counter = 1

Const Integer TIME_LIMIT = 60

While counter < TIME_LIMIT

Display counter

Set counter = counter + 1

End While

Display “Time’s up!”

8. A bug collector collects bugs every day for seven days. Design a solution that keeps a running total of the number of bugs collected during the seven days. The loop should ask for the number of bugs collected for each day, and when the loop is finished, the program should display the total number of bugs collected.

Looking for this or a Similar Assignment? Click below to Place your Order