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". This assignment will contain two (2) Parts: Written Paper and Visual Basic Prototype. The Visual Basic Prototype is not included in the total page count but is included in the e..

  Visual basic programming discussion

The use of decision logic is one of the major concepts of computer programming. The decision takes your code from being sequential to one that can take various options based on the different conditions. Determine the method of coding that you would u..

  Ticketseller

Use Visual basic 2010Visual Basic,  TicketSeller. This assignment will contain two (2) Parts: Event Planning Document and Coding phase. You must submit both parts as separate files for the completion of this assignment. Remember, you are only to de..

  Data storage & "exception error trapping"

Discussion on Data Storage and  "Exception Error Trapping".

  Designing vb applications across multiple platforms

Technical Project "Designing VB Applications Across Multiple Platforms".

  The implementation of server side of the application

Implementation of dynamic content, server side (backend) and database for your web site using Microsoft Visual Studio 2012

  Need help building a vwd website

Need help building a VWD website. This website may not go live. I have little progress as a family tragedy has impeded my time for school.

  To develop a visual basic console application

The aim of the assessment is to develop a Visual Basic console application that performs a number of mathematical functions. The mathematics package will be menu driven, i.e. a number of options will be displayed, and the user will be able to input w..

  Program in basic which prompts user to input two integers

Write down the program by using Small Basic which prompts the user to input two integers: firstNum and secondNum (firstNum must be less than secondNum).

  Develop vb-net application that includes arrays and loops

Develop a VB.NET application that includes arrays, loops, and IF statements to do the following. Your output must also display the number of applicant(s) being interviewed.

  Visual basic program to accept numeral values

Write a VISUAL BASIC program to accept numeral values of any unit, sum up the total, calculate the average, and then Output the result with a proper unit.

  Write a visual logic program to accept series of number

Write a Visual Logic program which accepts a series of numbers, until the first negative value is entered. The maximum number of non-negative input values is 250.

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