Comp230 Week 2key

Submitted by: Submitted by

Views: 10

Words: 1123

Pages: 5

Category: Science and Technology

Date Submitted: 10/18/2015 07:35 PM

Report This Essay

Student Name | | Class | | Date | |

VBScript IPO Lab Key

' VBScript: NameAge.vbs

' Written by: Student Name

' Date: Today's Date

' Class: COMP230

' Professor: Professor Name

' ==============================================

'Create name and age variables

name = ""

ageStr = ""

' Prompt User for Name and Age

WScript.StdOut.Write("Pleasse Enter your Full Name .............. ")

name = WScript.StdIn.ReadLine()

WScript.StdOut.WriteLine() 'Skip 1 line

WScript.StdOut.Write("Please Enter your age ..................... ")

ageStr = Wscript.StdIn.ReadLine()

' Calculate Age+10 and assign to ageStr10

ageStr10 = CStr( CInt(ageStr)+10 )

' Display Name and Age Values

WScript.StdOut.WriteBlankLines(2) 'Skip 2 lines

WScript.StdOut.WriteLine("Your Name is " & vbTab & vbTab & name)

WScript.StdOut.WriteLine("Your Age is " & vbTab & vbTab & ageStr)

WScript.StdOut.WriteLine(vbCrLf & "Your Age in 10 years is ...... " & _

ageStr10 & vbCrLf)

WScript.StdOut.WriteLine("End of Program")

' VBScript: NameAge.vbs

' Written by: Student Name

' Date: Today's Date

' Class: COMP230

' Professor: Professor Name

' ==============================================

'Create name and age variables

name = ""

ageStr = ""

' Prompt User for Name and Age

WScript.StdOut.Write("Pleasse Enter your Full Name .............. ")

name = WScript.StdIn.ReadLine()

WScript.StdOut.WriteLine() 'Skip 1 line

WScript.StdOut.Write("Please Enter your age ..................... ")

ageStr = Wscript.StdIn.ReadLine()

' Calculate Age+10 and assign to ageStr10

ageStr10 = CStr( CInt(ageStr)+10 )

' Display Name and Age Values

WScript.StdOut.WriteBlankLines(2) 'Skip 2 lines

WScript.StdOut.WriteLine("Your Name is " & vbTab & vbTab & name)

WScript.StdOut.WriteLine("Your Age is " & vbTab & vbTab & ageStr)

WScript.StdOut.WriteLine(vbCrLf & "Your Age in 10 years is ...... " & _

ageStr10 & vbCrLf)...