Question

In: Computer Science

Using If-Else conditional statement write a Visual Basic Program to display: (i) “STOP” if the user...

Using If-Else conditional statement write a Visual Basic Program to display:

(i) “STOP” if the user enters “R”

(ii) “CAUTION” if the user enters “Y”

(iii) “GO” if the user enters “G”

(iv) “Invalid” if the user enters any other character

Solutions

Expert Solution


Module VBModule
Sub Main()
'variable declartion
Dim ch As String
  
'get user input

  Console.Write("Enter a character: ")
ch = Console.ReadLine()
  
'check if input is "R"
If ch = "R" Then
Console.WriteLine("STOP")
  
'check if input is "Y"
elseif ch = "Y" Then
Console.WriteLine("CAUTION")
  
'check if input is "G"
elseif ch = "G" Then
Console.WriteLine("GO")
  
else
Console.WriteLine("Invalid")
End If
  
End Sub
End Module

The screenshot of the above source code is given below:

OUTPUT:

Enter a character: Y                                                           

CAUTION


Related Solutions

I am trying to write code for a program in Visual Studo using Visual Basic programming...
I am trying to write code for a program in Visual Studo using Visual Basic programming language that computes the factorial of an entered number by using a For Loop. My problem is that it keeps re-setting the variable for Factorial. Below is my code if anyone can help. I want it to multiply the given number by that number - 1, then continuing to do so until it hits zero without multiplying by zero. Private Sub BtnCalculate_Click(sender As Object,...
create a Visual Basic project with the following features: 1. The user interface can display the...
create a Visual Basic project with the following features: 1. The user interface can display the following information, one textbox for one item: 1a. Author, in the form of Lastname, Firstname 1b. Title 1c. Source -- where the paper is published 1d. Abstract 1e. Publication year (This information is in the 1c. Source, but display the publication year separately here) 2. There is a command button "Import". It would allow the user to select the eric.txt as the input file...
(using for loop, parameters, if, else condition only )Python: Write a program that prompts the user...
(using for loop, parameters, if, else condition only )Python: Write a program that prompts the user to enter a positive integer value, and compute the following sequence: • If the value is even, halve it. • If it's odd, multiply by 3 and add 1. • Repeat this process until the value is 1, printing out each value. • Then print out how many of these operations you performed. If the input value is less than 1, print a message...
Exercise 2.1: Basic digital signals (a) Write a MATLAB program to generate and display (using the...
Exercise 2.1: Basic digital signals (a) Write a MATLAB program to generate and display (using the stem function) the signals defined in Table 1. The MATLAB code of the first signal (dirac) is given in the report template as an example. (b) Write a MATLAB function [x, t] = sin_NU(f0, fs, T) to generate a sine signal. The output parameters x and t are the signal and time vectors, respectively. The input parameters are f0 (signal frequency in Hz), fs...
Description: To create a Visual Basic program that will obtain a sentence from the user, parse...
Description: To create a Visual Basic program that will obtain a sentence from the user, parse the sentence, and then display a sorted list of the words in the sentence with duplicate words removed. Tasks: Design a method (algorithm) to solve the above problem using pseudocode or a flowchart. Translate your algorithm into an appropriate VB program and test it using the following input sentence. "We are the world We are the children" Submit: Pseudocode version of algorithm/Flowchart version of...
Program on Visual Basic, VBA Create an application that lets the user enter a number of...
Program on Visual Basic, VBA Create an application that lets the user enter a number of seconds and produces output according to the following criteria: There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds. There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or...
Create a program in visual basic that allows the user to manage vehicle information including: •...
Create a program in visual basic that allows the user to manage vehicle information including: • License plate number • Owner name • Owner phone number The user interface will be GUI-based providing the following capabilities: • Add up to 100 vehicles • Remove specified vehicles • View a sorted list of all known license plates • View the data for a specified vehicle • Save the database contents into a file • Load a saved database from a file
Using Visual Studio write a program that allows the user to enter multiple scores ranging from...
Using Visual Studio write a program that allows the user to enter multiple scores ranging from 0 to 100, computes the average of those scores and then writes out a letter grade using the typical grading scale. Your program will also: 1. Allow the user to enter any number of scores he or she wishes but assume there will be at least one score entered. 2. Use a sentinel-controlled loop variable to terminate the loop when the user has no...
1- Write a program that will display the following series of integers using iterative statement of...
1- Write a program that will display the following series of integers using iterative statement of your choice, and terminate the iteration once it is larger than 200. 1, 3, 7, 13, 21, 31, 43, … use only C++!!
We need to create basic program that will simply display a menu and allow the user...
We need to create basic program that will simply display a menu and allow the user to select one of the choices. The menu should be displayed such that each option will be numbered, as well as have one capital letter so as to indicate that either the number or the designated letter can be entered to make their choice. Once the choice is made, the sub-menu for that selection should be displayed. Colors with an odd number of letters...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT