Question
COMP230 Lab week 4: VBScript IP Array Lab In this lab, students will complete the following objectives. Create a VBScript Program using NotePad++. Access a
COMP230 Lab week 4: VBScript IP Array Lab
In this lab, students will complete the following objectives.
- Create a VBScript Program using NotePad++.
- Access a two-dimensional array.
- Use a Nested For Loop to display array contents.
- Use Do/While loops for error-handling.
- Use CStr( ), CInt( ), and chr( ) functions.
These are the following codes I need help with that I got from the instruction, I know that I have to use the proper codes above I just dont know where to place them.
' This initialize a 2-dimension array ' of IP Address. The first index +100 ' is the room# and the second index+1 ' is the computer# in the room. dim ipAddress(5,3) ipAddress(0,0)="192.168.10.11" ipAddress(0,1)="192.168.10.12" ipAddress(0,2)="192.168.10.13" ipAddress(0,3)="192.168.10.14" ipAddress(1,0)="192.168.10.19" ipAddress(1,1)="192.168.10.20" ipAddress(1,2)="192.168.10.21" ipAddress(1,3)="192.168.10.22" ipAddress(2,0)="192.168.10.27" ipAddress(2,1)="192.168.10.28" ipAddress(2,2)="192.168.10.29" ipAddress(2,3)="192.168.10.30" ipAddress(3,0)="192.168.10.35" ipAddress(3,1)="192.168.10.36" ipAddress(3,2)="192.168.10.37" ipAddress(3,3)="192.168.10.38" ipAddress(4,0)="192.168.10.43" ipAddress(4,1)="192.168.10.44" ipAddress(4,2)="192.168.10.45" ipAddress(4,3)="192.168.10.46" ipAddress(5,0)="192.168.10.51" ipAddress(5,1)="192.168.10.52" ipAddress(5,2)="192.168.10.53" ipAddress(5,3)="192.168.10.54"
' Define Script Variables roomStr="" compStr="" room=0 computer=0
While number <= 0 '(a negative number is invalid data) Print error message, ask user to re-enter Read number End While
Display Prompt "Please Enter the Room Number (100-105) ......"
Get StdIn Console Input and assign string value to RoomStr
room = CInt(roomStr) While room < 100 OR room > 105 Use StdOut to Beep Speaker twice with chr(7) Display ErrMsg "Error, 100 to 105 Only!!!" Display Prompt "Please Enter the Room Number (100-105) ......" Get StdIn Console Input and assign string value to roomStr room = CInt(roomStr) End While
Display Prompt Please Enter the Computer Number (1-4) ...... Get StdIn Console Input and assign string value to compStr computer = CInt(compStr) While computer < 1 OR computer > 4 Use StdOut to Beep Speaker twice with chr(7) Display ErrMsg Error, 1 to 4 Only!!! Display Prompt Please Enter the Computer Number (1-4) ...... Get StdIn Console Input and assign string value to compStr computer = CInt(compStr) End While
Display message " The IP Address in Room " roomStr " for computer " compStr " is " ipAddress(room-100,computer-1)
Display All IP Address Y/N? Display Message "Do you wish to Display all of the IP Addresses (Y/N) ..... " Get User Response and assign it to variable ans If ans = "Y" OR ans = "y" Then skip line For room = 0 to 5 For computer = 0 to 3 Display "The IP Address in Room " (room+100) " for Computer " (computer+1) " is " ipAddress(room,computer) Next Next End If
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started