Suppose you would like your code to perform several tasks: Use a For…Next loop with an InputBox to prompt the user four times for the price of four different T-shirts, then display each shirt price with a 25% discount in the ListBox lstResult. Which of the following code segments correctly performs these tasks?
A) Dim intIndex As Integer Dim sngPrice, sngDiscountPrice As Single
For intIndex = 0 To 4
SngPrice = CSngInputBox"Enter price of shirt " & intIndex.ToString) )
SngDiscountPrice = sngPrice * 0.75
LstResult.Items.AddsngDiscountPrice)
Next
B) Dim intIndex As Integer Dim sngPrice, sngDiscountPrice As Single
For intIndex = 0 To 4
SngPrice = CSngInputBox"Enter price of shirt " & intIndex.ToString) )
SngDiscountPrice = sngPrice - .25 * sngPrice)
Next
LstResult.Items.AddsngDiscountPrice)
C) Dim intIndex As Integer Dim sngPrice, sngDiscountPrice As Single
For intIndex = 1 To 4
SngPrice = CSngInputBox"Enter price of shirt " & intIndex.ToString) )
SngDiscountPrice = sngPrice * 0.75
LstResult.Items.AddsngDiscountPrice)
Next
D) Dim intIndex As Integer Dim sngPrice, sngDiscountPrice As Single
For intIndex = 1 To 4
SngPrice = CSngInputBox"Enter price of shirt " & intIndex.ToString) )
SngDiscountPrice = sngPrice * 0.25
LstResult.Items.AddintIndex & " " & sngDiscountPrice)
Next
Correct Answer:
Verified
Q1: What is wrong with the following code?
Q5: Which standard Visual Basic function returns the
Q8: What is the difference in the execution
Q12: Which code example will calculate the number
Q17: Which property determines the amount of time,
Q22: A _is a loop inside another loop.
A)
Q27: The InputBox function always returns a _value.
A)
Q30: A difference between a ListBox and a
Q33: If lstMonths is a ListBox, which of
Q35: Which of the following statements correctly displays
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents