Unit 4: Labs LAB - 4.1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Chris trimble

Tuesday Night
7/8/2014

Unit 4
LABS
LAB--4.1
Module Main()
//Declare local variables
1.
2.
3.
4.
5.

Declare
Declare
Declare
Declare
Declare

String clientName
Real feetUtp
Real subTotal
Real taxCost
Real totalCost

//Module Calls
6. call inputData (feetUTP, clientName)
7. call calcCost()
8. call displayBill()
//this module takes in the required user input. There will be a display and input for
each variable
Module inputData(Real Ref feetUTP, String Ref clientName
9. display enter client name
10.input clientName
11.display enter your number of UTP
12.input feetUTP
End Module
//this module calculates subTotal, taxCost, and totalCost
//you also need feetUTP passed in to calculate subTotal
Module calcCosts(13.Real feetUTP, real ref subTotal, Real Ref taxCost, Real Ref
totalCost)
13.subTotal = feetUTP * .21
14.taxCost = subTotal * .06
15.totalCost = subTotal + taxCost
End Module

//this module displays clientName and totalCost


Module displayBill()
16.display (Clients Name Is +clientName)
17.display (Total Cost Is +totalCost)
End Module

LAB--4.2

LAB--4.3
Module Module1
Dim clientName As String = "NO VALUE"
Dim feetUTP As Double = 0

Dim
Dim
Dim
Sub

subTotal As Double = 0.21


taxCost As Double = 0.06
totalCost As Double = 0
Main()
InputData(clientName, feetUTP)
CalcCosts(feetUTP, subTotal, taxCost, totalCost)
FinalBill(clientName, totalCost)

Console.Write("Press enter to continue...")


Console.ReadLine()
End Sub
Sub InputData(ByRef clientName As String, ByRef feetUTP As Double)
Console.Write("Enter the clients name: ")
clientName = Console.ReadLine()
Console.Write("Enter the number of feet of UTP installed: ")
feetUTP = Console.ReadLine()
End Sub
Sub CalcCosts(ByRef feetUTP As Double, ByRef subTotal As Double, ByRef
taxCost As Double, ByRef totalCost As Double)
totalCost = (feetUTP * subTotal)
totalCost += totalCost * taxCost
End Sub
Sub FinalBill(ByRef clientName As String, ByRef totalCost As Double)
Console.WriteLine("Client Name: " + clientName)
Console.WriteLine("Total Cost: " + totalCost.ToString)
Console.WriteLine()
End Sub
End Module

LAB-4.4
Module Module1

Sub Main()
PingMe()
OpenWebsite()
FinalOutput()
Console.WriteLine()
Console.WriteLine("Press Enter To Close")
Console.ReadLine()
End Sub
Sub PingMe()
Shell("Ping.exe 127.0.0.1", , True)
End Sub
Sub OpenWebsite()
Dim myTargetURL As String = "http://www.microsoft.com"
System.Diagnostics.Process.Start(myTargetURL)
End Sub
Sub FinalOutput()
Console.WriteLine("PingMe pings server to get a reply.")
Console.WriteLine("OpenWebsite it opens Internet Explorer with the
Website in it")
End Sub
End Module

You might also like