You are on page 1of 5

Chris trimble

Chris trimble Unit 7 Lab


7.1 Step 1
Module main ()
//Declare local variables
Declare String clientName =
Declare Real feetUTP = 0
Declare Real subTotal = 0
Declare Real taxCost = 0
Declare Real totalCost = 0
//Module calls
Call inputData(feetUTP, clientName)
Call calcCosts(feetUTP, subTotal, taxCost, totalCost)
Call displayBill(clientName, totalCost)
End Module
Step 2
Module main ()
Declare String keepGoing = y
While keepGoing == y
//Declare local variables
Declare String clientName =
Declare Real feetUTP = 0
Declare Real subTotal = 0
Declare Real taxCost = 0
Declare Real totalCost = 0
//Module calls
Call inputData(feetUTP, clientName)
Call calcCosts(feetUTP, subTotal, taxCost, totalCost)
Call displayBill(clientName, totalCost)
Display Do you want to do this again?
Display (Enter y for yes)
Input keepGoing
End While
End Module
7.2

Chris trimble

7.3

Chris trimble

//Declare loop control variable


Declare Integer counter = 0
Declare Integer toPower = 2
Declare number = 2
While counter<7
toPower=number^2
Set Number = number + 1
Display 2 to the power of, number, is, toPower
//increment counter
Set counter = counter + 1
End While

7.4

7.5

Chris trimble
Pseudocode
Enter Pseudocode here
VB edit with control count loop
Module Module1
Sub Main()
pingMe()
openWebsite()
finalOutput()

End Sub
Sub pingMe()
Shell("Ping.exe 127.0.0.1", , True)
End Sub
Sub openWebsite()
Dim myURL As String = "http://www.homedepot.com"
System.Diagnostics.Process.Start(myURL)
End Sub
Sub finalOutput()
Console.ReadLine()
Console.WriteLine("Ping.exe allows you to verify that you have a network
connection.")
Console.WriteLine("The Shell function allows you to run a program in the
console.")
Console.WriteLine("Dim is how we denote a DISPLAY command.")
'this causes a pause so you can see your program
Console.ReadLine()
Console.Write("Press enter to end...")
Console.ReadLine()
End Sub
End Module

Lab 7.6 While and Do While Loops: Visual Basic Challenge II

Module Module1
Sub Main()
Dim keepGoing As String = "y"
While keepGoing = "y"
Call displayPower()
Console.WriteLine("Would you like to ping again? If so type y.")

Chris trimble
keepGoing = Console.ReadLine()
End While
End Sub
Sub displayPower()
Dim counter As Integer = 1
Dim toPower As Integer = 0
Dim number As Integer = 2
While counter <= 7
toPower = 2 ^ number
Console.WriteLine("2 to the power of " & number & " = " & toPower)
counter = counter + 1
number = number + 1
End While
End Sub
End Module

You might also like