Solved

Suppose You Would Like Your Code to Perform Several Tasks

Question 31

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions