40364: Write an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than or equal to 65, and adds 1 to the variable nonSeniors otherwise.
If (age >= 65) Then
seniorCitizens += 1
Else
nonSeniors += 1
End If
40365: Write an if/else statement that compares the value of the variables soldYesterday and soldToday, and based upon that comparison assigns salesTrend the value -1 or 1. -1 represents the case where soldYesterday is greater than soldToday; 1 represents the case where soldYesterday is not greater than soldToday.
If (soldYesterday > soldToday) Then
salesTrend = -1
Else
salesTrend = 1
End If
40366: Write an if/else statement that assigns true to the variable fever is the variable temperature is greater than 98.6; otherwise it assigns false to fever.
If (temperature > 98.6) Then
fever = true
Else
fever = false
End If
41120: Note: in mathematics, division by zero is undefined. Assume a text box named textBox from which datat will ber ead. 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".
callsReceived = textBox.Text
operatorsOnCall = textBox.Text
If (operatorsOnCall = 0) Then
System.Console.WriteLine("INVALID")
Else
System.Console.WriteLine(callsReceived \ operatorsOnCall)
End If
vbasic games
ReplyDelete