Determine the output: 1. 2. ntroduction to Programming Using visual Basic T(10t
ID: 3873132 • Letter: D
Question
Determine the output:
1.
2.
ntroduction to Programming Using visual Basic T(10t Chapter 4.2, Problem 4E Bookmark Show all steps: ON Problem Private Sub btnDisplay_Click(..) Handles btnDisplay.Click Determine the cost of a piece of cloth. Dim length, cost as Decimal length = CDec(InputBox("Enter length of cloth in yards.")) If length1 Then cost 3D 'cost in dollars Else cost-3D+(length- 1) 2.5D) End If txtBox. Text = "Cost of cloth: " & cost.To String("C") End Sub Assume the response is 6.) Step-by-step solutionExplanation / Answer
Assuming the response in the input box is 6
The 6 is assigned to the variable length, hence length = 6
The program will execute the else part since the value of length is greater than 1, hence calculated cost = 3 + (( length - 1 ) * 2.5)
=> 3 + (( 6 - 1 ) * 2.5 )
=> 3 + ((5) * 2.5 )
=> 3 + 12.5
=> 15.5
Hence output is:
Cost of cloth: $15.50
Assuming the input was the letter a
After inputting 'a' the next step in the program is the input is converted to upper case and is stored in the same variable Itr. Hence now Itr = "A"
Matching with the if condition, it was found that A is a vowel, hence vowel = true
Hence the output is:
A is a vowel.
Problem 1stAssuming the response in the input box is 6
The 6 is assigned to the variable length, hence length = 6
The program will execute the else part since the value of length is greater than 1, hence calculated cost = 3 + (( length - 1 ) * 2.5)
=> 3 + (( 6 - 1 ) * 2.5 )
=> 3 + ((5) * 2.5 )
=> 3 + 12.5
=> 15.5
Hence output is:
Cost of cloth: $15.50
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.