This is Visual Basics...
Write an if/else statement that assigns true to the variable fever if the variable temperature is greater than 98.6; otherwise it assigns false to fever.*
Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 and adds 1 to the variable seniors if age is 65 or older.*
The Visual basic for the given scenario is given below. Both the scenario are included in the same code-
Sub temp()
Dim temp ' Declaring variables
Dim fever
Dim age
Dim minors
Dim adults
Dim senior
minor = 2
adults = 5
senior = 2
temp = InputBox("Enter temperature") ' Getting temp input from
user
If temp > 98.6 Then 'Checking the condition in if else
fever = True 'Assigning true if condition is true
Else
fever = False ' Assigning false if condition is false
End If
MsgBox ("Is fever: " & fever) ' Displaying the result
age = InputBox("Enter Age") ' Getting age from the user
If age < 18 Then 'Checking the condition
minor = minor + 1 'Incrementing minor
ElseIf age > 18 And age < 64 Then 'Checking another
condition
adults = adults + 1 'Incrementing adult
Else
senior = senior + 1 ' Incrementing senior
End If
'Displaying the result
MsgBox ("Minor = " & minor & " Adult =" & adults &
" Senior = " & senior)
End Sub
Code screenshot
Output
This is Visual Basics... Write an if/else statement that assigns true to the variable fever if...
Write an if/else statement that adds 1 to minors if age is less than 18, adds 1 to adults if age is 18 through 64 and adds 1 to seniors if age is 65 or older.
Write in C: 1.) Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64, and adds 1 to the variable seniors if age is 65 or older. 2.) Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the message "player1 wins" is printed to standard out. When score2...
Use only C++ languages, please!!! Assume: int age; int minors = 0; int adults = 0; int seniors = 0; Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 inclusive, and adds 1 to the variable seniors if age is 65 or older.
Python Write if/else code that adds one to the variable adults if the value of age is greater or equal to 18, and adds one to the variable minors otherwise.
EXERCISES: if & if...else STATEMENTS: Name Examples of if and if-else statements: Write an if statement that multiplies payRate by 1.5 iſ hours is greater than 40. Write variable declarations for the variables payRate and hours first. Hint: Look for keyword if first, your boolean comes after the keyword [. This translates into Java as: double hours, payRate; if (hours > 40) { //{-} are optional here but I recommend that you them payRate = payRate 1.5; pay Rato pay...
Question Five c++ Decision Structures and Boolean Logic 1. Write an if statement that assigns 20 to the variable y and assigns 40 to the variable z if the variable x is greater than 100. 2. Write an if statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. 3. Write an if-else statement that assigns 0 to the variable b if the variable a is less...
5. (12 points) Consider the following code fragment (part of a program): int index 3; String dna "ACTGTCA char nucleotide dna.charAt (index); Matching: For each term below, write the letter of the ONE choice that best matches the term. Data types Variables Literals Object Method ーParameter nde x a. coumt, nucleotide, and d b. 3 and "ACTGTCA c. int, char, and String d. index e. charAt f. dna na 6. (10 points) a. Wrte a statement that assigns true to...
Write as assignment statement that assigns WA to an existing string variable state. Visual Studio 2019. Language C#.
Programming question. Using Visual Studio 2019 C#. Windows Forms Application. Write the code that assigns the number 15 to the reward variable when the state variable contains the string “IL” (entered using any case) and the sales variable contains a number that is greater than 2000; otherwise, assign the number 5.
Small aircraft weight limit Write an if-else statement that assigns safetyCheck with 1 if the sum of passengerWeight and cargoWeight is less than or equal maxWeight. Otherwise, assign safetyCheck with 0. Ex: If passengerWeight is 200, cargoWeight is 100, and maxWeight is 500, then safetyCheck is assigned with 1. If passengerWeight is 300, cargoWeight is 275, and maxWeight is 500, then safetyCheck is assigned with 0. Function Save C Reset DI MATLAB Documentation 1 function safetyCheck = CargoLimit(passengerWeight, cargoweight) 2...