Unit 7 Homework (from Ch 5)
1.) Describe the difference between pretest loops and posttest loops.
2.) What is a conditioned-controlled loop.
3.) What is a count-controlled loop.
4.) What is an infinite loop. Write the code for an infinite loop.
5.) Design a While loop that lets the user enter a number. The number should be multiplied by 10, and the result stored in a variable named product. The loop should stop once product contains a value > 100.
6.) Design a For loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50,……..100
7.) Convert the following While loop in the following code to a Do-While loop:
Declare integer x = 1
While x > 0 Display “Enter a number. (0 to quit)” Input x
End While
8.) Convert the following While loop to a For loop:
Declare integer count = 0
While count < 50 Display “The count is “, count
Set count = count + 1
End While
9.) A bug collector collects bugs every day for 7 days. Design a program that keeps a running total of the number of bugs collected during the 7 days. The loop should ask for the number of bugs collected each day, and when the loop is finished, the program should display the total number of bugs collected.
For Question 9 -- Paste you pseudo code here. DO NOT paste Visual Basic program code as your design solution. That will result in 10 points deducted from the homework assignment.
*****************************************************************
Unit 7 Labs
7.1) Condition-Controlled Loops.
Write the flowchart for a program that displays the numbers 1 through 7 using a condition controlled loop (While and/or Do-While loops).
Paste your flowchart here.
7.2) Condition-Controlled Loops.
Write the Visual Basic program for 7.1 above.
Paste your program code and screen shot of your program output here
7.3) Count Controlled Loops
Design a program that uses a Count Controlled Loop to produce the following:
N 10*N 100*N 1000*N
1