can some one please help me with these questions in within the next 30 minutes.
ID: 3692572 • Letter: C
Question
can some one please help me with these questions in within the next 30 minutes. I need this badly.
1. Write the VBScript code lines that perform the following tasks: Define a variable age that is initialized to 35. Display a message that uses the variable to display Your age is 35, but 10 years ago, you were 25. Note: The value 25 is calculated from the variable age. Also note the period at the end of the displayed output.
2. Given the variables hoursWorked and payRate, write the VBScript code that will calculate grossPay such that all hoursWorked above 40 hours will be paid at time and a half.
3. Write a VBScript function called GetName( ) that prompts the user to input his or her name and returns the name value. Use the StdIn and StdOut streams for input and output.
Explanation / Answer
Answer 1:
dim age
age = 35
Wscript.Echo "Your age is " & age & ", but in 10 years you will be " & (age -10) & "."
Answer 2:
'Given
dim hoursWorked
dim payRate
dim grossPay
'Vars
dim otHours
'For testing
hoursWorked = 41
payRate = 1
If (hoursWorked > 40) Then
otHours = (hoursWorked - 40)
hoursWorked = 40
Else
otHours = 0
End If
grossPay = (hoursWorked * payRate) + (otHours * payRate * 1.5)
'For testing:
WScript.Echo "grossPay=" & grossPay
Answer 3:
tName()
n = WScript.StdIn
t.StdOut.Write("Please enter your name:")
e = objStdIn.ReadLine()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.