Concept explainers
Rewrite the following If-Then-Else If statement as a Select Case statement.
If selection == 1 Then
Display "You selected A."
Else If selection == 2 Then
Display "You selected 2."
Else If selection == 3 Then
Display "You selected 3."
Else If selection == 4 Then
Display "You selected 4."
Else
Display "Not good with numbers, eh?"
End If
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Starting Out with Programming Logic and Design (4th Edition)
Additional Engineering Textbook Solutions
Introduction To Programming Using Visual Basic (11th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Database Concepts (7th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Introduction to Programming Using Visual Basic (10th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
- Write an if statement that determines whether the variable sales is greater than or equal to 10,000. If it is, assign 0.2 to the variable commissionRate.arrow_forwardis an optional clause available for the Case Structure when no match is found in any of the Case statements. * O Default O Else Case O Elself O Case Elsearrow_forwardWrite an if-else statement that determines whether the value of the points variable is less than 9 or greater than 51. If this is true, display “Invalid points.” Otherwise, display “Valid points.”arrow_forward
- QUESTION 3 An "if.else" statement (without esle if) is used when The 'yes' and 'no' conditions in the diagram end in different points When you need one action to execute if the conditional evaluate to "True' and a different action when it evaluated to "False" When the condition evaluates to True O When the condition evaluates to Falsearrow_forwardWrite an if-else statement that works like this: If the sales variable is greater- than or equal-to 50,000, the commissionRate variable should be assigned the value 0.2. Otherwise, the commissionRate variable should be assigned the value 0.1.arrow_forwardWrite 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. 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. Write an if-else statement that assigns 0 to the variable b if the variable a is less than 10. Otherwise, it should assign 99 to the variable b. Write nested decision structures that perform the following: If amount1 is greater than 10 and amount2 is less than 100, display the greater of amount1 and amount2.arrow_forward
- Write an if-else statement that asks the user to enter the speed at which he is driving. If the speed is more than 50 print ‘Speed in limit’, else print ‘Speed should be checked’.arrow_forwardWrite an if-else statement that works like this: If the sales variable is greaterthan or equal-to 50,000, the commissionRate variable should be assigned the value 0.2. Otherwise, the commissionRate variable should be assigned the value 0.1.arrow_forwardAssume choice references a string. The following if statement determines whether choice is equal to ‘Y’ or ‘y’:if choice == 'Y' or choice == 'y':Rewrite this statement so it only makes one comparison and does not use the or operator. (Hint: use either the upper or lower methods.)arrow_forward
- Write an if statement that assigns 0.2 to commissionRate if sales is greater than or equal to 10000.arrow_forwardUsing if/else/elif statement write a program for a customer coming to a bank. He/she will be asked for his/her name first. He/she will be provided with different option i.e. do you have an account in the bank. If you have an account, do you want to access the account, or do you want to pay the utility bills. If you don’t have an account, do you want to open a new account, or do you want to pay the utility bills. Finish the code with the note “Thank you for banking with us”arrow_forward1): Q: p = F, q = T, and r = T. Select the expression that evaluates to false. Group of answer choices A): ¬q B): q∨r C): q∧r D): p∨r 2): Q: Select the statement that is false. a. If 3 is a prime number, then 5 is a prime number. b.If 4 is a prime number, then 6 is a prime number. c.If 4 is a prime number, then 5 is a prime number. d. If 3 is a prime number, then 6 is a prime number. Group of answer choices d a b carrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT