SlideShare a Scribd company logo
1 of 21
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 1
This lab requires you to think about the steps that take place in
a program by writing
pseudocode. Read the following program prior to completing
the lab.
Career Tech Placement is hiring employees for placement at
technology firms across the
city. Prior to granting an interview, the company has a 100-
point test that is used to
determine if the candidate should be interviewed. Depending on
the candidate’s score,
he or she will be placed in 1 of 4 categories for possible
employment and flagging for an
interview:
Score Employment Category Interview Possibility
85 or above Definite Yes
70 – 84 Likely Yes
60 – 69 Maybe Yes
59 or below No No
Career Tech Placement has asked you to write a program that
will allow the company to
enter a test score and then set the employment category and the
interview possibility
variables based on the chart above.
Given the major task involved in this program, you decide your
program should have three
variables and three modules:
Variable Name Purpose
Declare Integer testScore = 0 Stores the test score of the
candidate.
Declare String category = “ “ Stores Definite, Likely, Maybe, or
No
Declare String interview = “ “ Stores Yes or No
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 2
Module Name Purpose
Module getScore() Allows the user to enter the test score
Module employCat() Determines the employment category
Module interviewPoss() This module will determine if a day off
should
be awarded.
Module displayInfo() Displays the testScore, category, and
interview
variables.
Step 1: Complete the pseudocode by writing the missing lines.
When writing your modules and
making calls, be sure to pass necessary variables as arguments
and accept them as reference
parameters if they need to be modified in the module
(Reference: Testing a Series of
Conditions, page 138 from your textbook, Starting Out with
Programming Logic & Design.).
Main Module()
//Declare variables on the next 3 lines
//Make Module calls and pass necessary variables on the next 4
lines
End Main
Module getScore(Integer Ref testScore)
//Ask the user to enter a test score
End Module
Module employCat(Integer testScore, String Ref category)
//Determine what employment category they are in based on
their test score
//Similar to if the score is less than 60, then category is “No”
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 3
//Otherwise, if score is less than 70 then category is “Maybe”
//…and so on
End Module
Module interviewPoss(Integer testScore, String Ref interview)
//Determine if they qualify for an interview based on their test
score
//Similar to if the score is less than 60, then interview is “No”
//Otherwise, interview is “Yes”
End Module
Module displayInfo(Integer testScore, String category, String
interview)
//Display the three variables
End Module
This lab requires you to convert the pseudocode and flowchart
into an actual program using
Visual Basic.
Step 1: Launch Visual Basic and create a new Console
Application. Save it to the appropriate
location.
Step 2: We will be using modules in this program, so all
variables and module calls will go
between of Sub Main() and End Sub. In VB, start by declaring
and initializing your variables and
making module calls such as:
Sub Main()
'declare your 3 variables similar format such as
'Dim variableName As DataType = 0 (or “ “ if it’s a string)
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 4
'call your 4 modules and pass necessary variables similar
'format such as
'moduleName(arguments)
'add this to cause a pause
Console.WriteLine("Press enter to continue...")
Console.ReadLine()
End Sub
Your module looks like this:
Step 3: Code the getScore() module so that the user enters a test
score. Remember to use
ByRef so the value of testScore is retained. This module will
look like:
Sub getScore(ByRef testScore As Integer)
'add the code to input testScore
End Sub
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 5
Step 4: Code the employCat() module that will determine the
category placement. Remember
to use ByRef so the value of category is retained. This module
will look like:
Sub employCat(byVal testScore as Integer, byRef category as
String)
'add the code to evaluate conditions
If testScore < 60 Then
category = "No"
ElseIf testScore < 70 Then
category = "Maybe"
ElseIf testScore < 85 Then
category = "Likely"
Else
category = "Definite"
End If
End Sub
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 6
Your module may look like this:
Step 5: Code the interviewPoss() module that will determine the
interview value. Use ByRef for
interview, and byVal for testScore. This will be a simple If
Then Else that will set the interview
variable to either “Yes” or “No.
Step 6: Code the displayInfo() module and use
Console.WriteLine() to display the values of the
three variables. All three variables can be passed as ByVal.
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 7
Step 7: Save, build, and execute your program so that it works.
Your output might look like this:
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 8
Step 8: 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:
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 9
b. In Windows Explorer, navigate to the folder that contains
your project files. Your
Windows Explorer might look as follows:
(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:UsersinstructorDocumentsVisual Studio
2010ProjectsmyFirstProgrammyFirstProgramModule1.vb; in
this case navigate to
C:UsersinstructorDocumentsVisual Studio 2010Projects).
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: Decision Structures in Pseudocode and Visual Basic
Page 10
d. Attach the compressed folder you created to your submission.
Your Windows Explorer
might look as follows:
PT1420: Repetition Structures in Visual Basic
Page 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
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
Page 2
Your module looks like this:
b. Run the program by clicking the green arrow that points to
the right or by going
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
Page 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
Page 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
Page 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
g
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
Page 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
Page 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
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
Page 8
PT1420: Repetition Structures in Visual Basic
Page 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
Page 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:UsersinstructorDocumentsVisual Studio
2010ProjectsmyFirstProgrammyFirstProgramModule1.vb; in
this case navigate to
C:UsersinstructorDocumentsVisual Studio 2010Projects).
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
Page 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?

More Related Content

Similar to PT1420: Decision Structures in Pseudocode and Visual Basic

Devry cis 170 c i lab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and stringsDevry cis 170 c i lab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and stringsjody zoll
 
CIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.comCIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.combellflower82
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   llflowe
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   bellflower42
 
CIS 170 Inspiring Innovation/tutorialrank.com
 CIS 170 Inspiring Innovation/tutorialrank.com CIS 170 Inspiring Innovation/tutorialrank.com
CIS 170 Inspiring Innovation/tutorialrank.comjonhson110
 
Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com  Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com amaranthbeg143
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsnoahjamessss
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringscskvsmi44
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labsccis224477
 
Use of Classes and functions#include iostreamusing name.docx
 Use of Classes and functions#include iostreamusing name.docx Use of Classes and functions#include iostreamusing name.docx
Use of Classes and functions#include iostreamusing name.docxaryan532920
 
Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7comp274
 
Cis 170 Education Organization -- snaptutorial.com
Cis 170   Education Organization -- snaptutorial.comCis 170   Education Organization -- snaptutorial.com
Cis 170 Education Organization -- snaptutorial.comDavisMurphyB99
 
Cis 170 i lab 1 of 7
Cis 170 i lab 1 of 7Cis 170 i lab 1 of 7
Cis 170 i lab 1 of 7helpido9
 
Diving into VS 2015 Day2
Diving into VS 2015 Day2Diving into VS 2015 Day2
Diving into VS 2015 Day2Akhil Mittal
 
Cis 170 c Enhance teaching / snaptutorial.com
Cis 170 c  Enhance teaching / snaptutorial.comCis 170 c  Enhance teaching / snaptutorial.com
Cis 170 c Enhance teaching / snaptutorial.comHarrisGeorg51
 
CIS 170 Education Specialist / snaptutorial.com
CIS 170  Education Specialist / snaptutorial.comCIS 170  Education Specialist / snaptutorial.com
CIS 170 Education Specialist / snaptutorial.comMcdonaldRyan138
 
Cis 170 Education Organization / snaptutorial.com
Cis 170 Education Organization / snaptutorial.comCis 170 Education Organization / snaptutorial.com
Cis 170 Education Organization / snaptutorial.comBaileya126
 
CIS 170 Exceptional Education - snaptutorial.com
CIS 170   Exceptional Education - snaptutorial.comCIS 170   Exceptional Education - snaptutorial.com
CIS 170 Exceptional Education - snaptutorial.comDavisMurphyB33
 

Similar to PT1420: Decision Structures in Pseudocode and Visual Basic (20)

ADLAB.pdf
ADLAB.pdfADLAB.pdf
ADLAB.pdf
 
Devry cis 170 c i lab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and stringsDevry cis 170 c i lab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and strings
 
CIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.comCIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.com
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   
 
CIS 170 Inspiring Innovation/tutorialrank.com
 CIS 170 Inspiring Innovation/tutorialrank.com CIS 170 Inspiring Innovation/tutorialrank.com
CIS 170 Inspiring Innovation/tutorialrank.com
 
Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com  Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com
 
MPP-UPNVJ
MPP-UPNVJMPP-UPNVJ
MPP-UPNVJ
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labs
 
Use of Classes and functions#include iostreamusing name.docx
 Use of Classes and functions#include iostreamusing name.docx Use of Classes and functions#include iostreamusing name.docx
Use of Classes and functions#include iostreamusing name.docx
 
Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7Cis 170 ilab 1 of 7
Cis 170 ilab 1 of 7
 
Cis 170 Education Organization -- snaptutorial.com
Cis 170   Education Organization -- snaptutorial.comCis 170   Education Organization -- snaptutorial.com
Cis 170 Education Organization -- snaptutorial.com
 
Cis 170 i lab 1 of 7
Cis 170 i lab 1 of 7Cis 170 i lab 1 of 7
Cis 170 i lab 1 of 7
 
Diving into VS 2015 Day2
Diving into VS 2015 Day2Diving into VS 2015 Day2
Diving into VS 2015 Day2
 
Cis 170 c Enhance teaching / snaptutorial.com
Cis 170 c  Enhance teaching / snaptutorial.comCis 170 c  Enhance teaching / snaptutorial.com
Cis 170 c Enhance teaching / snaptutorial.com
 
CIS 170 Education Specialist / snaptutorial.com
CIS 170  Education Specialist / snaptutorial.comCIS 170  Education Specialist / snaptutorial.com
CIS 170 Education Specialist / snaptutorial.com
 
Cis 170 Education Organization / snaptutorial.com
Cis 170 Education Organization / snaptutorial.comCis 170 Education Organization / snaptutorial.com
Cis 170 Education Organization / snaptutorial.com
 
CIS 170 Exceptional Education - snaptutorial.com
CIS 170   Exceptional Education - snaptutorial.comCIS 170   Exceptional Education - snaptutorial.com
CIS 170 Exceptional Education - snaptutorial.com
 

More from amrit47

APA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxAPA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxamrit47
 
APA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxAPA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxamrit47
 
Apa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxApa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxamrit47
 
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxAPA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxamrit47
 
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
APA format     httpsapastyle.apa.orghttpsowl.purd.docxAPA format     httpsapastyle.apa.orghttpsowl.purd.docx
APA format  httpsapastyle.apa.orghttpsowl.purd.docxamrit47
 
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxAPA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxamrit47
 
APA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxAPA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxamrit47
 
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxAPA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxamrit47
 
APA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxAPA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxamrit47
 
APA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxAPA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxamrit47
 
Appearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxAppearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxamrit47
 
apa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxapa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxamrit47
 
APA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxAPA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxamrit47
 
APA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxAPA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxamrit47
 
APA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxAPA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxamrit47
 
APA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxAPA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxamrit47
 
APA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxAPA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxamrit47
 
APA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxAPA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxamrit47
 
APA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxAPA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxamrit47
 
APA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxAPA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxamrit47
 

More from amrit47 (20)

APA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxAPA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docx
 
APA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxAPA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docx
 
Apa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxApa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docx
 
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxAPA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
 
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
APA format     httpsapastyle.apa.orghttpsowl.purd.docxAPA format     httpsapastyle.apa.orghttpsowl.purd.docx
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
 
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxAPA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
 
APA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxAPA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docx
 
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxAPA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
 
APA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxAPA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docx
 
APA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxAPA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docx
 
Appearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxAppearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docx
 
apa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxapa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docx
 
APA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxAPA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docx
 
APA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxAPA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docx
 
APA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxAPA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docx
 
APA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxAPA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docx
 
APA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxAPA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docx
 
APA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxAPA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docx
 
APA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxAPA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docx
 
APA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxAPA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docx
 

Recently uploaded

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

PT1420: Decision Structures in Pseudocode and Visual Basic

  • 1. PT1420: Decision Structures in Pseudocode and Visual Basic Page 1 This lab requires you to think about the steps that take place in a program by writing pseudocode. Read the following program prior to completing the lab. Career Tech Placement is hiring employees for placement at technology firms across the city. Prior to granting an interview, the company has a 100- point test that is used to determine if the candidate should be interviewed. Depending on the candidate’s score, he or she will be placed in 1 of 4 categories for possible employment and flagging for an interview: Score Employment Category Interview Possibility 85 or above Definite Yes 70 – 84 Likely Yes
  • 2. 60 – 69 Maybe Yes 59 or below No No Career Tech Placement has asked you to write a program that will allow the company to enter a test score and then set the employment category and the interview possibility variables based on the chart above. Given the major task involved in this program, you decide your program should have three variables and three modules: Variable Name Purpose Declare Integer testScore = 0 Stores the test score of the candidate. Declare String category = “ “ Stores Definite, Likely, Maybe, or No Declare String interview = “ “ Stores Yes or No PT1420: Decision Structures in Pseudocode and Visual Basic Page 2
  • 3. Module Name Purpose Module getScore() Allows the user to enter the test score Module employCat() Determines the employment category Module interviewPoss() This module will determine if a day off should be awarded. Module displayInfo() Displays the testScore, category, and interview variables. Step 1: Complete the pseudocode by writing the missing lines. When writing your modules and making calls, be sure to pass necessary variables as arguments and accept them as reference parameters if they need to be modified in the module (Reference: Testing a Series of Conditions, page 138 from your textbook, Starting Out with Programming Logic & Design.). Main Module() //Declare variables on the next 3 lines //Make Module calls and pass necessary variables on the next 4 lines
  • 4. End Main Module getScore(Integer Ref testScore) //Ask the user to enter a test score End Module Module employCat(Integer testScore, String Ref category) //Determine what employment category they are in based on their test score //Similar to if the score is less than 60, then category is “No” PT1420: Decision Structures in Pseudocode and Visual Basic Page 3 //Otherwise, if score is less than 70 then category is “Maybe” //…and so on End Module Module interviewPoss(Integer testScore, String Ref interview) //Determine if they qualify for an interview based on their test score //Similar to if the score is less than 60, then interview is “No” //Otherwise, interview is “Yes”
  • 5. End Module Module displayInfo(Integer testScore, String category, String interview) //Display the three variables End Module This lab requires you to convert the pseudocode and flowchart into an actual program using Visual Basic. Step 1: Launch Visual Basic and create a new Console Application. Save it to the appropriate location. Step 2: We will be using modules in this program, so all variables and module calls will go between of Sub Main() and End Sub. In VB, start by declaring and initializing your variables and making module calls such as: Sub Main() 'declare your 3 variables similar format such as 'Dim variableName As DataType = 0 (or “ “ if it’s a string)
  • 6. PT1420: Decision Structures in Pseudocode and Visual Basic Page 4 'call your 4 modules and pass necessary variables similar 'format such as 'moduleName(arguments) 'add this to cause a pause Console.WriteLine("Press enter to continue...") Console.ReadLine() End Sub Your module looks like this: Step 3: Code the getScore() module so that the user enters a test score. Remember to use ByRef so the value of testScore is retained. This module will look like: Sub getScore(ByRef testScore As Integer) 'add the code to input testScore End Sub
  • 7. PT1420: Decision Structures in Pseudocode and Visual Basic Page 5 Step 4: Code the employCat() module that will determine the category placement. Remember to use ByRef so the value of category is retained. This module will look like: Sub employCat(byVal testScore as Integer, byRef category as String) 'add the code to evaluate conditions If testScore < 60 Then category = "No" ElseIf testScore < 70 Then category = "Maybe" ElseIf testScore < 85 Then category = "Likely" Else category = "Definite"
  • 8. End If End Sub PT1420: Decision Structures in Pseudocode and Visual Basic Page 6 Your module may look like this: Step 5: Code the interviewPoss() module that will determine the interview value. Use ByRef for interview, and byVal for testScore. This will be a simple If Then Else that will set the interview variable to either “Yes” or “No. Step 6: Code the displayInfo() module and use Console.WriteLine() to display the values of the three variables. All three variables can be passed as ByVal.
  • 9. PT1420: Decision Structures in Pseudocode and Visual Basic Page 7 Step 7: Save, build, and execute your program so that it works. Your output might look like this: PT1420: Decision Structures in Pseudocode and Visual Basic Page 8 Step 8: Submit the Visual Basic code as a compressed (zipped) folder using the following steps: a. Open Windows Explorer --> Start --> All Programs -->
  • 10. Accessories --> Windows Explorer. Your Windows Explorer might look as follows: PT1420: Decision Structures in Pseudocode and Visual Basic Page 9 b. In Windows Explorer, navigate to the folder that contains your project files. Your Windows Explorer might look as follows: (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:UsersinstructorDocumentsVisual Studio 2010ProjectsmyFirstProgrammyFirstProgramModule1.vb; in this case navigate to C:UsersinstructorDocumentsVisual Studio 2010Projects). Your module properties might look as follows:
  • 11. 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: Decision Structures in Pseudocode and Visual Basic Page 10 d. Attach the compressed folder you created to your submission. Your Windows Explorer might look as follows: PT1420: Repetition Structures in Visual Basic Page 1 This lab requires you to write the program in the Visual Basic
  • 12. 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 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()
  • 13. Console.Write("Hello " & strFname & vbCrLf) Console.Write("Press any key to close") Console.ReadLine() PT1420: Repetition Structures in Visual Basic Page 2 Your module looks like this: b. Run the program by clicking the green arrow that points to the right or by going 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:
  • 14. PT1420: Repetition Structures in Visual Basic Page 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
  • 15. 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 Page 4 Call collectAndValidateName() Console.Write("Press any key to close") Console.ReadLine() End Sub Your module looks like this:
  • 16. 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 Page 5 strFname = Console.ReadLine() 'check if the user entered a value If strFname = "" Then
  • 17. 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 g 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 Page 6
  • 18. 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 Page 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 e. Test you code to make sure you have to provide each piece of information
  • 19. before exiting the program. Your final output looks like this: PT1420: Repetition Structures in Visual Basic Page 8 PT1420: Repetition Structures in Visual Basic Page 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:
  • 20. PT1420: Repetition Structures in Visual Basic Page 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:UsersinstructorDocumentsVisual Studio 2010ProjectsmyFirstProgrammyFirstProgramModule1.vb; in this case navigate to C:UsersinstructorDocumentsVisual Studio 2010Projects). 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
  • 21. Page 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?