Repetition structures in visual basic

Assignment Help Visual Basic Programming
Reference no: EM13820287

PART  1

This lab requires you to write the program in the Visual Basic console application using loops. Read the following program prior to completing the lab.

Food Incorporated wants you to create a small program that will ask customers to enter their name, address, city, state, zip code and to validate that they provide the information in order to complete the program.

Complete the following lab tasks.

Step 1: Start the program

a. Create a new Visual Basic Console Application by going to file ? New project

b. Name the application lab4.2_fname_lname and click Ok

Step 2: Create the initial code asking for the user's name

a. In the main function write the following code to request a user to enter their name and pause the program when finished:

'Create the variables

Dim strFname As String = ""

Console.Write("Enter your first name:")

strFname = Console.ReadLine()

Console.Write("Hello " & strFname & vbCrLf)

Console.Write("Press any key to close")

Console.ReadLine()

PT1420: Repetition Structures in Visual Basic

PART  2

Your module looks like this:

b. Run the program by clicking the green arrow that points to the right or by going to debug ? start debugging Test your program by first entering your name; observe what happens. Test your program again but this time just press Enter. Note, nothing stopped you from entering your name. Your output looks like this:

PT1420: Repetition Structures in Visual Basic

PART  3

Step 3: Add a module to collect input

a. Create a new module called collectAndValidateName() and move the input of the users information to this module. Update your main function to look like the following:

Sub collectAndValidateName()

'Create the variables

Dim strFname As String = ""

'Create the first validation loop

'Prompt for user to enter name

Console.Write("Enter your first name:")

'Read user input

strFname = Console.ReadLine()

'check if the user entered a value

Console.Write("Hello " & strFname & vbCrLf)

Console.Write("Press any key to close")

Console.ReadLine()

b. Call your collectAndValidateName() module from the main() module. Update your main function to look like the following:

Sub Main()

PT1420: Repetition Structures in Visual Basic

PART  4

Call collectAndValidateName()

Console.Write("Press any key to close")

Console.ReadLine()

End Sub

Your module looks like this:

Step 4: Add Input Validation using a do while loop

a. We will now add the code to make sure that the user submits their name before we continue and say hi to them. Update your collect AndValidateName module to look like the following:

'Create the first validation loop

Do While strFname = ""

'Prompt for user to enter name

Console.Write("Enter your first name: ")

'Read user input

PT1420: Repetition Structures in Visual Basic

PART  5

strFname = Console.ReadLine()

'check if the user entered a value

If strFname = "" Then

Console.Write("You did not enter a value, try again" & vbCrLf)

End If

Loop

Console.Write("Hello " & strFname & vbCrLf)

End Sub

b. Run the program by clicking the green arrow that points to the right or by going to debug ? start debugging

o Test your program by first entering your name, observe what happens

c. Test your program again but this time just hit enter. Note that your program now requires you to enter your name before continuing to say hello to them. Your output looks like this:

PT1420: Repetition Structures in Visual Basic

PART  6

Step 5: Add additional code to ask the user to enter their address, city, state and zip code. You can use any of the looping methods covered in this week's material.

a. Using step 3 create additional modules to validate that the user provides his or her address, city, state, and zip code. Your module looks like this:

PT1420: Repetition Structures in Visual Basic

PART  7

b. Using step 4, create loops to validate that the user provides his or her address, city, state, and zip code.

c. Write out to the screen the information that the user provided.

d. Run the program by clicking the green arrow that points to the right or by going to debug ? start debugging

e. Test you code to make sure you have to provide each piece of information before exiting the program. Your final output looks like this:

PT1420: Repetition Structures in Visual Basic

PART  8

PT1420: Repetition Structures in Visual Basic

PART  9

Step 6: Submit the Visual Basic code as a compressed (zipped) folder using the following steps:

a. Open Windows Explorer --> Start --> All Programs --> Accessories --> Windows Explorer. Your Windows Explorer might look as follows:

b. In Windows Explorer, navigate to the folder that contains your project files. Your Windows Explorer might look as follows:

PT1420: Repetition Structures in Visual Basic

PART  10

(If you don't recall you can check in Visual Studio by opening your project, right click module1.vb file and view the properties. Look at the full path ex. C:\Users\instructor\Documents\Visual Studio 2010\Projects\myFirstProgram\myFirstProgram\Module1.vb; in this case navigate to C:\Users\instructor\Documents\Visual Studio 2010\Projects). Your module properties might look as follows:

c. Right click on your project folder and choose send to --> compressed folder. This creates a zip file of all your code. Your Windows Explorer might look as follows:

PT1420: Repetition Structures in Visual Basic

PART  11

d. Attach the compressed folder you created to your submission. Your Windows Explorer might look as follows:

THOUGHT QUESTIONS:

1. Were you able to successfully complete the code to validate the address, city, state, and zip code? If not, what went wrong?

2. What types of loops did you try to use in this assignment?

3. What are some ways that you think this program could be improved?

Reference no: EM13820287

Questions Cloud

Identify the nutritional needs for a developing embryo : Identify the nutritional needs for a developing embryo and fetus and how to obtain them - Identify health concerns or disease associated with poor nutrition during the gestation period.
The products formed when nitroglycerin undergoes hydrolysis : the products formed when nitroglycerin undergoes hydrolysis
Determine the scope of the district production warehouse : Review the project case. Determine the scope of the District 4 Production Warehouse Move project from the information provided in the case
Rovide examples of good and bad nutritional choices : Identify the nutritional needs for a developing embryo and fetus and how to obtain them - Identify health concerns or disease associated with poor nutrition during the gestation period.
Repetition structures in visual basic : Repetition Structures in Visual Basic
Realistic strategies that carnival corporation : Develop two feasible/realistic strategies that Carnival Corporation could follow. you should provide one short term and one long term strategy and give a brief description about the details of "WHAT" each strategy is about. Your strategies should ..
Define community in any way you see fit : How is community both antithetical to and supportive of individuality in the works we've read this semester? You can define community in any way you see fit, be it family or "society" or humanity. Decide your focus.  How would you present this novel ..
What characteristics the effective leader possessed : Describe what characteristics the effective leader possessed, and explain how those characteristics contributed to his or her success.
Assignment on create an encoding scheme : Create an encoding scheme

Reviews

Write a Review

Visual Basic Programming Questions & Answers

  Designing vb applications across multiple platforms

Technical Project "Designing VB Applications Across Multiple Platforms".

  Permit a user to manipulate database using vb

Use VB to permit a user to manipulate database according to following: Permit the user to scroll through list of students while showing student ID, student name, advisor name, and department.

  Send a printout of interface to the printer

write a visual basic instruction to specify that of printform1 control should send a printout of interface to the printer.

  Shipping charge for the following zip codes

Need application code for visual basic should display the appropriate shipping charge. shipping charge for the following ZIP codes is $32: 60618, 60620, and 60632. All other ZIP codes are charged $37.75. Code the application in visual basic

  Create a gpa calculator

Once the user has entered this initial information, allow the list to be saved when the user exits the program. When the program starts, any existing data should be loaded automatically.

  Calculate the amount of a waiters tip

Write a program to carry out each task. The program should use variables for each of the quantities and display the outcome in a text box with a label.

  Arithmetic calculator applicationwrite an application that

arithmetic calculator applicationwrite an application that allows the user to enter a series of numbers and manipulate

  Assignment onnbspvisual basic nbsptechnical project

assignment onnbspvisual basic nbsptechnical project designing vb applications across multiple platforms this assignment

  Create visual logic files to execute each of the tasks

Create a Word document for each of the tasks. The document should contain: a brief description of the task the pseudocode associated with the task Create Visual Logic files to execute each of the tasks.

  Keep a record of the total attendance

Keep a record of the total attendance and the total cash collected from ticket sales from all events happening at the Games.

  What is wrong with the program segment

Which format statement should be used when you want to output your results in tabular format with the first column 10 characters wide, the second 5, and the third 10

  Create a sub procedure that calculates and displays the next

A national Digital service provider would like you to create a Windows application that will display the global growth of smartphones. As of 2013, there 913 million smartphones worldwide.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd