(9) Declare appropriate variables and use If then Else statements to write VB co
ID: 3598942 • Letter: #
Question
(9) Declare appropriate variables and use If then Else statements to write VB code to determine amount of tip to be given to a waiter in a restaurant. The user inputs total bill in an InputBox function. If the bill is $50 or less than the tip should be 15% of the total bill, otherwise the tip should be 25% of the total bill. Display the check amount, tip amount and total bill amount in a listbox "LstShow. Must Declare all variables. 6 Points (10) Using For Next Loop, write a VB code that will display the following numbers as output in a ListBox 'LStA (13.1) 15, 19, 23, 27, 31,35 (13.2) -55,-49, -43,-37,-31 6 Points 6 Points (11) Write a VB code that uses "Do While" loop to find the sum of all ODD integer numbers between 1 and 100. Declare all appropriate variables. 8 PointsExplanation / Answer
9)
' Calculate tip value
if( myValue<=50) then tip= myValue+(0.15*myValue)
else tip= myValue+(0.25*myValue)
End if
11)
Dim index As Integer = 1
Dim temp As Integer=0
Do While index <= 100
'Check for odd element
If (index /2)<>0 Then temp=temp+ index
End If
index += 1
Loop
'Display Output
Debug.WriteLine("The sum is")
Debug.WriteLine(temp)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.