Do Loop tasks

Do Loop tasks
1) For each of the following loops, write down what will be outputted to the console.
Dim Q as integer
Dim balance as single, interest as single, n as
integer
Q =3
Do While Q<15
Q = 2 * q-1
Loop
Console.writeline(q)
Output:
Balance = 1000
Interest = .1
N=0
Do
Console.writeline(n & “ “ & balance)
Balance = (1+interest) * balance
N=n+1
Loop Until Balance > 1200
Console.WriteLine(n)
Output:
Dim number,pos as integer
Dim Password, EnteredPassword as string
Number = 0
Pos = 1
Password = “blob”
EnteredPassword = “”
Console.writeline(“Enter a number to count to”)
Console.writeline(“Please Enter Password”)
EnteredPassword = console.Readline()
Number = console.readline()
Do while pos <= number
Console.writeline(pos)
Pos = pos +1
Loop
Output (assume 5 has been entered):
Do while ucase(EnteredPassword) <>
ucase(Password)
Console. Clear()
Console.WriteLine(“Invalid Password Entered.
Try Again.”
enteredPassword = console.Readline()
Loop
Console.clear()
Console.writeline(“Welcome”)
Output:
2) Ask a user for a number. IF the number is between 1 and 10 then enter a loop which adds on
2 to the entered value, until the value is more than 20 (displaying each increment on the
screen). If the number is bigger than 10 or less than 1, enter a loop which increments the
number by 4 until the value reaches 100 (displaying each increment on the screen).
3) Create a program that gets two players to enter in their names and then you choose a
Gamenumber between 10 and 50. Each player takes it in turns to choose either 1,2 or 3.
This number is then deducted from the Gamenumber. The last person to deduct a number
from the Gamenumber before it reaches 0 loses.
4) Go back to you Add Student program you did for your IF Tasks. Below is a reminder of what
it was:
Create a program that meets the following requirement.
You need to create a program that stores a Student name and address and date of birth.
When the program starts the user is presented with a menu.
1) Add Student
2) Delete Student
3) Display Student
Choice:
The student variable is initialised to your name, address and DOB first.
1) Add Student
The user can add the details of a new student overwriting what is currently there – this is then
displayed.
2) Delete student
The current student details is deleted and this is displayed
3) Display student
The student details are displayed.
Now add a forth option – 4) Exit. Keep looping the above program until the user presses 4. Don’t
forget you can use Console.Clear inbetween iterations to clear the screen.