Assume a text box named textBox from which data will be read.

Assume a text box named textBox from which data will be read.

LANGUAGE: Visual Basic

CHALLENGE:

Note: in mathematics, division by zero is undefined. Assume a text box named textBox from which data will be read. Given a int variable named callsReceived and another int variable named operatorsOnCall write the necessary code to read values into callsReceived and operatorsOnCall and print out the number of calls received per operator (integer division with truncation will do). HOWEVER, if any value read in is not valid input, just print the message “INVALID”.

SOLUTION:

callsReceived = textBox.Text
operatorsOnCall = textBox.Text
If (operatorsOnCall = 0) Then
    System.Console.WriteLine("INVALID")
Else
    System.Console.WriteLine(callsReceived \ operatorsOnCall)
End If


Add comment