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
EBK STARTING OUT WITH PROGRAMMING LOGIC
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
- Write 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_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_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_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_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
- 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_forwardRepetition control structure The do.. while/while statements o The for statement Input validation 'o Use a repetition control structure for EACH user input Project Description The BlueMont chain hotels have 4 different types of room: Single room: $60/night Double room: $75/night King room: $100/night Suite room: $150/night The size of the hotel chains in different locations may be different in terms of the number of floors and the type and the number of rooms on each floor. You are required to write a program that calculates the occupancy rate and the total hotel income for one night and displays this information as well as some other information described below. The program starts by asking the location where this hotel chain is located and the number of floors in the hotel. The number of floors may not exceed 5. The User then enters the total number of rooms for each floor. The program then asks specifically the number of occupied rooms for each room type on this floor. The total…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT