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 = 1 To 4
SngPrice = CSng(InputBox("Enter price of shirt " & intIndex.ToString) )
SngDiscountPrice = sngPrice * 0.75
LstResult.Items.Add(sngDiscountPrice)
Next
B) Dim intIndex As Integer
Dim sngPrice, sngDiscountPrice As Single
For intIndex = 0 To 4
SngPrice = CSng(InputBox("Enter price of shirt " & intIndex.ToString) )
SngDiscountPrice = sngPrice - (.75 * sngPrice)
Next
LstResult.Items.Add(sngDiscountPrice)
C) Dim intIndex As Integer
Dim sngPrice, sngDiscountPrice As Single
For intIndex = 1 To 4
SngPrice = CSng(InputBox("Enter price of shirt " & intIndex.ToString) )
SngDiscountPrice = sngPrice * (.25 - sngPrice)
LstResult.Items.Add(sngDiscountPrice)
Next
D) Dim intIndex As Integer
Dim sngPrice, sngDiscountPrice As Single
For intIndex = 0 To 4
SngPrice = CSng(InputBox("Enter price of shirt " & intIndex.ToString) )
SngDiscountPrice = sngPrice * 0.25
LstResult.Items.Add(intIndex & " " & sngDiscountPrice)
Next
Correct Answer:
Verified
Q13: The entries in a ListBox are stored
Q14: Which of the following statements will assign
Q15: The _method can be used to place
Q16: Setting this property to True will put
Q17: Which property determines the amount of time,
Q19: How can you cause scroll bars to
Q20: Which of the following controls and methods
Q21: What is the difference in execution between
Q22: A _is a loop inside another loop.
A)
Q23: The SelectedItem property of a ListBox _.
A)
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