Question

Write a vbscript to enter the following information into a 2D array and display it in...

Write a vbscript to enter the following information into a 2D array and display it in a single msgbox with the header and calculated average GPA using loops

John     EET            2.7

April     NSA           3.5

Oliver NCM         3.8

Submit your lab as a single word document with the script and a screenshot of the output

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program:


'definition of a sub-procedure
sub info()

dim arr(3,3)
dim i,j
dim output
dim sum,avgGPA

sum=0.0

output="Student Information" & VbNewLine
output=output & "--------------------------" & VbNewLine

arr(0,0)="John"
arr(0,1)="EET"
arr(0,2)=2.7

arr(1,0)="April"
arr(1,1)="NSA"
arr(1,2)=3.5

arr(2,0)="Oliver"
arr(2,1)="NCM"
arr(2,2)=3.8

for i=0 to 2
for j=0 to 2
output=output & arr(i,j) & " "
next
sum=sum+CDbl(arr(i,2))
output=output & VbNewLine
next

avgGPA=CDbl(sum/3)

output=output & "--------------------------" & VbNewLine

output=output & "Average GPA: " & Round(avgGPA,2)
msgbox(output)

end sub


'calling sub-procedure

info

Output:

Windows Pow PS C:\Users\user\Desktop> cscript student.vbs Microsoft (R) windows script Host Version 5.812 Copyright (c) Micro

Note :

To run VBScript i have used commandPrompt/Powershell using command
cscript fileName.vbs
Example : cscript student.vbs

Add a comment
Know the answer?
Add Answer to:
Write a vbscript to enter the following information into a 2D array and display it in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT