SlideShare a Scribd company logo
1 of 10
DEVRY CIS 170 C iLab 4 of 7 Functions
Check this A+ tutorial guideline at
http://www.cis170entirecourse.com/cis-170/cis-
170-c-ilab-4-of-7-functions
For more classes visit
http://www.cis170entirecourse.com
www.cisl70entirecourse.com
CIS 170 C iLab 4 of 7 Functions
Lab # CIS CIS170C-A4 Lab 4 of 7: Functions Lab
Overview - Scenario/Summary You will code,
build, and execute a program that simulates the
dialing of a phone using functions.
Learning outcomes:
Distinguish between pass by value and by
reference. Call functions using &. Write functions
using value and reference. Be able to define and
use global named constants. Be able to debug a
program with syntax and logic errors. Be able to
use the debug step-into feature to step through the
logic of the program and to see how the variables
change values.Deliverables Section Deliverable
Points Lab 4
Step 5: Program Listing and Output
45
,
nch the
Lab Steps
Preparation
:If you are using the Citrix remote lab, follow the
login instructions located in the iLab tab in
CourseHome.
cate the Visual Studio 2010 icon and laui
application.
Lab:
Step 1: Requirements: Phone-Dialing Program
Write a program that simulates the dialing of
aphone number.
A user will input an 8-place number, for
example: UN9-3177 (note that the hyphen is
considered adigit).
The rules for entering phone numbers follow.
8 places It may have numbers, letters, or both.
The phone number cannot begin with 555. The
phone number cannot begin with 0. The hyphen
must be
in the 4th position. No other characters
(@#$%A
&*0_+=|/><="" p="">
If all of the rules are met, you will output a
message to the console that reads like the
following.
Phone Number Dialed: UN9-3177 *the number
entered
If all of the rules are not met, then you output one
of the following error messages to the console.
ERROR - Phone number cannot begin with 555
ERROR - Phone number cannot begin with 0
ERROR - Hyphen is not in the correct position
ERROR - An invalid character was entered
WWW:11
:iheis^m
lfbeia'lofiny *«om
Here are some great things to think about as you
begin your program!
Define a function named ReadDials() that reads
each digit and letter dialed into 8 separate char
variables (DO NOT USE ARRAYS). All the digits are
sent back through parameters by reference.
Then, for each digit, the program will use a
function named ToDigit(), which receives a single
char argument (pass by reference) that may be a
number or a letter of one of the digits dialed.
If it is a number, then return 0 by value indicating
that it is a valid digit. If the digit is a letter, then the
number corresponding to the letter is returned by
reference, and return 0 by value indicating that it
is a valid digit. Here are the letters associated with
each digit.
5
J K L 1
6
M N O 2
A B C
www.c1si.70en7
,,,,
3
D E F 8
T U V
4
G H I
9
W X Y Z
If the digit entered is not one of the valid digits or
one of the valid letters, return -1 by value
indicating that you have an invalid digit.
A phone number never begins with a 0, so the
program should flag an error if such a number is
entered. Make ReadDials() return -2 in this case.
A phone number never begins with 555, so the
program should flag an error if such a number is
entered. Make ReadDials() return -3 in this case. A
phone number always has a hyphen (-) in the 4th
position. Make ReadDials() return -4 in this case (if
it doesn't have a hyphen in the 4th position). If a
hyphen is in any other position, it is considered an
invalid digit.
If the phone number is valid, the main calls the
AcknowledgeCall function to write the converted
number to the output file.
All the logic of the program should be put in
functions that are called from Main(): ReadDials()
and AcknowledgeCall().
The ToDigits() function is called from the
ReadDials() function and is used to convert each
letter entered individually into a digit and to verify
that the user has entered a valid phone number.
Have the program work for any number of phone
numbers.
In the ToDigits() function uses the toupper
function to convert any letters entered to
uppercase. All the error messages are to be
written to the output file from main() based on the
return value from the functions.
Continue processing until the user enters a Q. You
will set up the 8 char variables to hold the digits of
the phone number in main() and pass the variables
to the functions by reference. Sample Output from
the Program Enter a phone number (Q to quit):
213-2121 Phone Number Dialed: 213-2121 Enter a
phone number (Q to quit): asc-dfer Phone Number
Dialed: 272-3337 Enter a phone number (Q to
quit): 555-resw ERROR - Phone number cannot
begin with 555 Enter a phone number (Q to quit):
098-8765 ERROR - Phone number cannot begin
with 0 Enter a phone number (Q to quit):
12345678 ERROR - Hyphen is not in the correct
position Enter a phone number (Q to quit): @34-
*uyt ERROR - An invalid character was entered
Enter a phone number (Q to quit): Q Press any key
to continue . . .
Step 2: Processing Logic
Using the pseudocode below, write the code that
will meet the requirements.
Main Function
Declare the char variables for the 8 digits of the
phone number
while true
Call the ReadDials function passing the 8 digits by
reference. ReadDials returns an error code by
value.
If the return value is -5, exit the do while loop If
the error code is -1, display the error message
"ERROR - An invalid character was
entered".
If the error code is -2, display the error message
"ERROR - Phone number cannot
begin with 0".
If the error code is -3, display the error message
"ERROR - Phone number cannot
www,fth,
begin with 55
error code is -4, r<y thi.comerror message "ERROR - Hyphen is not in the
correct position".
Otherwise, call the AcknowledgeCall function
End-While ReadDials function Input the first
digit If a Q was entered, return -5.
Input the rest of the phone number Call the
ToDigit function for each of the 7 digits
not for digit 4
If ToDigit returns -1, return -1 If digit 4 is not
a hyphen, return -4.
If digit 1 is 0, return -2.
If digits 1 - 3 are 5, return -3 Otherwise, return 0
ToDigit function Convert the digit to upper case
Use a switch statement to determine if the digit is
valid
and convert the letters to digits If the digit is
invalid, return -1.
If the digit is valid, return 0. AcknowledgeCall
function Display the Phone Number.
www.cStep 3: Create
,a N
r Projec
'.- .
Create a new project and name it LAB4.
Write your code using the processing logic in Step
2 (above). Make sure that you save your program.
Step 4: Compile and Execute
a) Compile your program. Eliminate all the
syntax
errors.
b) Build your program and verify the results of
the program. Make corrections to the program
logic, if
necessary, until the results of the program
execution are what you expect.
Step 5: Print Screen Shots and Program
Capture a screen print of your output (do a print
screen and paste into an MS Word document).
Copy your code and paste it into the same MS
Word document that contains the screen print of
your output. Save the Word document as
Lab04_LastName_FirstInitial.
END OF LAB
www.cisl70entirecourse.com
Capture a screen print of your output (do a print
screen and paste into an MS Word document).
Copy your code and paste it into the same MS
Word document that contains the screen print of
your output. Save the Word document as
Lab04_LastName_FirstInitial.
END OF LAB
www.cisl70entirecourse.com

More Related Content

What's hot

C chap02
C chap02C chap02
C chap02Kamran
 
05 control structures 2
05 control structures 205 control structures 2
05 control structures 2Jomel Penalba
 
Project 2 the second project involves/tutorialoutlet
Project 2 the second project involves/tutorialoutletProject 2 the second project involves/tutorialoutlet
Project 2 the second project involves/tutorialoutletMessanz
 
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
 
C programming tokens & error types
C  programming tokens & error typesC  programming tokens & error types
C programming tokens & error typesargusacademy
 
Estimating the product cost using microsoft excel
Estimating the product cost using microsoft excelEstimating the product cost using microsoft excel
Estimating the product cost using microsoft excelJames Paul Antonio
 
Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6solutionjug4
 
Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6helpido9
 
C and its errors
C and its errorsC and its errors
C and its errorsJunaid Raja
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab neweyavagal
 
C language questions_answers_explanation
C language questions_answers_explanationC language questions_answers_explanation
C language questions_answers_explanationsrinath v
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchartRabin BK
 
Part I (1.5 points) Write a C++ program that reads a line from the key...
Part I (1.5 points)        Write a C++ program that reads a line from the key...Part I (1.5 points)        Write a C++ program that reads a line from the key...
Part I (1.5 points) Write a C++ program that reads a line from the key...hwbloom104
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newscottbrownnn
 

What's hot (18)

C chap02
C chap02C chap02
C chap02
 
C chap02
C chap02C chap02
C chap02
 
05 control structures 2
05 control structures 205 control structures 2
05 control structures 2
 
SD & D Running Total
SD & D Running TotalSD & D Running Total
SD & D Running Total
 
Common Programming Errors
Common Programming ErrorsCommon Programming Errors
Common Programming Errors
 
Project 2 the second project involves/tutorialoutlet
Project 2 the second project involves/tutorialoutletProject 2 the second project involves/tutorialoutlet
Project 2 the second project involves/tutorialoutlet
 
Components of a python program
Components of a python program Components of a python program
Components of a python program
 
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
 
C programming tokens & error types
C  programming tokens & error typesC  programming tokens & error types
C programming tokens & error types
 
Estimating the product cost using microsoft excel
Estimating the product cost using microsoft excelEstimating the product cost using microsoft excel
Estimating the product cost using microsoft excel
 
Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6
 
Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6Cis 355 i lab 6 of 6
Cis 355 i lab 6 of 6
 
C and its errors
C and its errorsC and its errors
C and its errors
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
C language questions_answers_explanation
C language questions_answers_explanationC language questions_answers_explanation
C language questions_answers_explanation
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Part I (1.5 points) Write a C++ program that reads a line from the key...
Part I (1.5 points)        Write a C++ program that reads a line from the key...Part I (1.5 points)        Write a C++ program that reads a line from the key...
Part I (1.5 points) Write a C++ program that reads a line from the key...
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 

Similar to Devry cis-170-c-i lab-4-of-7-functions

Lec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdfLec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdfShwetaSaharan8
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEWshyamuopten
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
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
 
Looping in PythonLab8 lecture slides.pptx
Looping in PythonLab8 lecture slides.pptxLooping in PythonLab8 lecture slides.pptx
Looping in PythonLab8 lecture slides.pptxadihartanto7
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As CompDavid Halliday
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As CompDavid Halliday
 
I need help coming up with a MIPS program for this.1.3. Overvi.pdf
I need help coming up with a MIPS program for this.1.3. Overvi.pdfI need help coming up with a MIPS program for this.1.3. Overvi.pdf
I need help coming up with a MIPS program for this.1.3. Overvi.pdfpratyushraj61
 
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 170 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and stringsCis 170 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and stringsCIS321
 
Cis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingHamad Odhabi
 
Fundamentals of Programming Lecture #1.pptx
Fundamentals of Programming Lecture #1.pptxFundamentals of Programming Lecture #1.pptx
Fundamentals of Programming Lecture #1.pptxEyasu46
 
265 ge8151 problem solving and python programming - 2 marks with answers
265   ge8151 problem solving and python programming - 2 marks with answers265   ge8151 problem solving and python programming - 2 marks with answers
265 ge8151 problem solving and python programming - 2 marks with answersvithyanila
 
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 stringsshyaminfo04
 
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 stringsash52393
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchartlotlot
 

Similar to Devry cis-170-c-i lab-4-of-7-functions (20)

Lec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdfLec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdf
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEW
 
C programming language
C programming languageC programming language
C programming language
 
Cpp Homework Help
Cpp Homework Help Cpp Homework Help
Cpp Homework Help
 
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
 
Looping in PythonLab8 lecture slides.pptx
Looping in PythonLab8 lecture slides.pptxLooping in PythonLab8 lecture slides.pptx
Looping in PythonLab8 lecture slides.pptx
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As Comp
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As Comp
 
I need help coming up with a MIPS program for this.1.3. Overvi.pdf
I need help coming up with a MIPS program for this.1.3. Overvi.pdfI need help coming up with a MIPS program for this.1.3. Overvi.pdf
I need help coming up with a MIPS program for this.1.3. Overvi.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 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and stringsCis 170 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and strings
 
Cis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programming
 
Fundamentals of Programming Lecture #1.pptx
Fundamentals of Programming Lecture #1.pptxFundamentals of Programming Lecture #1.pptx
Fundamentals of Programming Lecture #1.pptx
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
 
Assignment 2
Assignment 2Assignment 2
Assignment 2
 
265 ge8151 problem solving and python programming - 2 marks with answers
265   ge8151 problem solving and python programming - 2 marks with answers265   ge8151 problem solving and python programming - 2 marks with answers
265 ge8151 problem solving and python programming - 2 marks with answers
 
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
 
C++ lecture 01
C++   lecture 01C++   lecture 01
C++ lecture 01
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
 

More from noahjamessss

Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesDevry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesnoahjamessss
 
Devry cis-170-c-i lab-6-of-7-menu
Devry cis-170-c-i lab-6-of-7-menuDevry cis-170-c-i lab-6-of-7-menu
Devry cis-170-c-i lab-6-of-7-menunoahjamessss
 
Devry cis-170-c-i lab-3-of-7-looping
Devry cis-170-c-i lab-3-of-7-loopingDevry cis-170-c-i lab-3-of-7-looping
Devry cis-170-c-i lab-3-of-7-loopingnoahjamessss
 
Devry cis-170-c-i lab-2-of-7-decisions
Devry cis-170-c-i lab-2-of-7-decisionsDevry cis-170-c-i lab-2-of-7-decisions
Devry cis-170-c-i lab-2-of-7-decisionsnoahjamessss
 
Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startednoahjamessss
 
Devry busn-278-entire-course
Devry busn-278-entire-courseDevry busn-278-entire-course
Devry busn-278-entire-coursenoahjamessss
 
Busn 278-week-4-midterm
Busn 278-week-4-midtermBusn 278-week-4-midterm
Busn 278-week-4-midtermnoahjamessss
 
Bus 650-week-6-final-paper-financial-analysis-the-lg-group
Bus 650-week-6-final-paper-financial-analysis-the-lg-groupBus 650-week-6-final-paper-financial-analysis-the-lg-group
Bus 650-week-6-final-paper-financial-analysis-the-lg-groupnoahjamessss
 
Ash bus-650-week-2-return-on-investment-education-funding
Ash bus-650-week-2-return-on-investment-education-fundingAsh bus-650-week-2-return-on-investment-education-funding
Ash bus-650-week-2-return-on-investment-education-fundingnoahjamessss
 
Ash bus-650-week-2-dq-2-managing-earnings
Ash bus-650-week-2-dq-2-managing-earningsAsh bus-650-week-2-dq-2-managing-earnings
Ash bus-650-week-2-dq-2-managing-earningsnoahjamessss
 
Ash bus-650-week-2-dq-1-initial-investment
Ash bus-650-week-2-dq-1-initial-investmentAsh bus-650-week-2-dq-1-initial-investment
Ash bus-650-week-2-dq-1-initial-investmentnoahjamessss
 
Ash bus-650-week-1-dq-2-short-term-or-long-term-view
Ash bus-650-week-1-dq-2-short-term-or-long-term-viewAsh bus-650-week-1-dq-2-short-term-or-long-term-view
Ash bus-650-week-1-dq-2-short-term-or-long-term-viewnoahjamessss
 
Ash bus-650-ash-complete-class
Ash bus-650-ash-complete-classAsh bus-650-ash-complete-class
Ash bus-650-ash-complete-classnoahjamessss
 
Keller hsm 541 week 7 course project due
Keller hsm 541 week 7 course project dueKeller hsm 541 week 7 course project due
Keller hsm 541 week 7 course project duenoahjamessss
 
Hrm 326 final exam guide
Hrm 326 final exam guideHrm 326 final exam guide
Hrm 326 final exam guidenoahjamessss
 
Mkt 421 final exam guide (new, 2017) new
Mkt 421 final exam guide (new, 2017) newMkt 421 final exam guide (new, 2017) new
Mkt 421 final exam guide (new, 2017) newnoahjamessss
 
Uop phl 458 week 3 dq 1 new
Uop phl 458 week 3 dq 1 newUop phl 458 week 3 dq 1 new
Uop phl 458 week 3 dq 1 newnoahjamessss
 
Uop phl 458 week 1 dq 1 new
Uop phl 458 week 1 dq 1 newUop phl 458 week 1 dq 1 new
Uop phl 458 week 1 dq 1 newnoahjamessss
 
Uop str 581 week 4
Uop str 581 week 4Uop str 581 week 4
Uop str 581 week 4noahjamessss
 
Uop str 581 capstone final exam part 2 new
Uop str 581 capstone final exam part 2 newUop str 581 capstone final exam part 2 new
Uop str 581 capstone final exam part 2 newnoahjamessss
 

More from noahjamessss (20)

Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesDevry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-files
 
Devry cis-170-c-i lab-6-of-7-menu
Devry cis-170-c-i lab-6-of-7-menuDevry cis-170-c-i lab-6-of-7-menu
Devry cis-170-c-i lab-6-of-7-menu
 
Devry cis-170-c-i lab-3-of-7-looping
Devry cis-170-c-i lab-3-of-7-loopingDevry cis-170-c-i lab-3-of-7-looping
Devry cis-170-c-i lab-3-of-7-looping
 
Devry cis-170-c-i lab-2-of-7-decisions
Devry cis-170-c-i lab-2-of-7-decisionsDevry cis-170-c-i lab-2-of-7-decisions
Devry cis-170-c-i lab-2-of-7-decisions
 
Devry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-startedDevry cis-170-c-i lab-1-of-7-getting-started
Devry cis-170-c-i lab-1-of-7-getting-started
 
Devry busn-278-entire-course
Devry busn-278-entire-courseDevry busn-278-entire-course
Devry busn-278-entire-course
 
Busn 278-week-4-midterm
Busn 278-week-4-midtermBusn 278-week-4-midterm
Busn 278-week-4-midterm
 
Bus 650-week-6-final-paper-financial-analysis-the-lg-group
Bus 650-week-6-final-paper-financial-analysis-the-lg-groupBus 650-week-6-final-paper-financial-analysis-the-lg-group
Bus 650-week-6-final-paper-financial-analysis-the-lg-group
 
Ash bus-650-week-2-return-on-investment-education-funding
Ash bus-650-week-2-return-on-investment-education-fundingAsh bus-650-week-2-return-on-investment-education-funding
Ash bus-650-week-2-return-on-investment-education-funding
 
Ash bus-650-week-2-dq-2-managing-earnings
Ash bus-650-week-2-dq-2-managing-earningsAsh bus-650-week-2-dq-2-managing-earnings
Ash bus-650-week-2-dq-2-managing-earnings
 
Ash bus-650-week-2-dq-1-initial-investment
Ash bus-650-week-2-dq-1-initial-investmentAsh bus-650-week-2-dq-1-initial-investment
Ash bus-650-week-2-dq-1-initial-investment
 
Ash bus-650-week-1-dq-2-short-term-or-long-term-view
Ash bus-650-week-1-dq-2-short-term-or-long-term-viewAsh bus-650-week-1-dq-2-short-term-or-long-term-view
Ash bus-650-week-1-dq-2-short-term-or-long-term-view
 
Ash bus-650-ash-complete-class
Ash bus-650-ash-complete-classAsh bus-650-ash-complete-class
Ash bus-650-ash-complete-class
 
Keller hsm 541 week 7 course project due
Keller hsm 541 week 7 course project dueKeller hsm 541 week 7 course project due
Keller hsm 541 week 7 course project due
 
Hrm 326 final exam guide
Hrm 326 final exam guideHrm 326 final exam guide
Hrm 326 final exam guide
 
Mkt 421 final exam guide (new, 2017) new
Mkt 421 final exam guide (new, 2017) newMkt 421 final exam guide (new, 2017) new
Mkt 421 final exam guide (new, 2017) new
 
Uop phl 458 week 3 dq 1 new
Uop phl 458 week 3 dq 1 newUop phl 458 week 3 dq 1 new
Uop phl 458 week 3 dq 1 new
 
Uop phl 458 week 1 dq 1 new
Uop phl 458 week 1 dq 1 newUop phl 458 week 1 dq 1 new
Uop phl 458 week 1 dq 1 new
 
Uop str 581 week 4
Uop str 581 week 4Uop str 581 week 4
Uop str 581 week 4
 
Uop str 581 capstone final exam part 2 new
Uop str 581 capstone final exam part 2 newUop str 581 capstone final exam part 2 new
Uop str 581 capstone final exam part 2 new
 

Recently uploaded

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Recently uploaded (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Devry cis-170-c-i lab-4-of-7-functions

  • 1. DEVRY CIS 170 C iLab 4 of 7 Functions Check this A+ tutorial guideline at http://www.cis170entirecourse.com/cis-170/cis- 170-c-ilab-4-of-7-functions For more classes visit http://www.cis170entirecourse.com www.cisl70entirecourse.com CIS 170 C iLab 4 of 7 Functions Lab # CIS CIS170C-A4 Lab 4 of 7: Functions Lab Overview - Scenario/Summary You will code, build, and execute a program that simulates the dialing of a phone using functions. Learning outcomes: Distinguish between pass by value and by reference. Call functions using &. Write functions using value and reference. Be able to define and use global named constants. Be able to debug a program with syntax and logic errors. Be able to use the debug step-into feature to step through the
  • 2. logic of the program and to see how the variables change values.Deliverables Section Deliverable Points Lab 4 Step 5: Program Listing and Output 45 , nch the Lab Steps Preparation :If you are using the Citrix remote lab, follow the login instructions located in the iLab tab in CourseHome. cate the Visual Studio 2010 icon and laui application. Lab: Step 1: Requirements: Phone-Dialing Program Write a program that simulates the dialing of aphone number. A user will input an 8-place number, for example: UN9-3177 (note that the hyphen is considered adigit). The rules for entering phone numbers follow. 8 places It may have numbers, letters, or both. The phone number cannot begin with 555. The phone number cannot begin with 0. The hyphen must be
  • 3. in the 4th position. No other characters (@#$%A &*0_+=|/><="" p=""> If all of the rules are met, you will output a message to the console that reads like the following. Phone Number Dialed: UN9-3177 *the number entered If all of the rules are not met, then you output one of the following error messages to the console. ERROR - Phone number cannot begin with 555 ERROR - Phone number cannot begin with 0 ERROR - Hyphen is not in the correct position ERROR - An invalid character was entered WWW:11 :iheis^m lfbeia'lofiny *«om Here are some great things to think about as you begin your program! Define a function named ReadDials() that reads each digit and letter dialed into 8 separate char variables (DO NOT USE ARRAYS). All the digits are sent back through parameters by reference. Then, for each digit, the program will use a function named ToDigit(), which receives a single char argument (pass by reference) that may be a number or a letter of one of the digits dialed.
  • 4. If it is a number, then return 0 by value indicating that it is a valid digit. If the digit is a letter, then the number corresponding to the letter is returned by reference, and return 0 by value indicating that it is a valid digit. Here are the letters associated with each digit. 5 J K L 1 6 M N O 2 A B C www.c1si.70en7 ,,,, 3 D E F 8 T U V 4 G H I 9 W X Y Z If the digit entered is not one of the valid digits or one of the valid letters, return -1 by value indicating that you have an invalid digit.
  • 5. A phone number never begins with a 0, so the program should flag an error if such a number is entered. Make ReadDials() return -2 in this case. A phone number never begins with 555, so the program should flag an error if such a number is entered. Make ReadDials() return -3 in this case. A phone number always has a hyphen (-) in the 4th position. Make ReadDials() return -4 in this case (if it doesn't have a hyphen in the 4th position). If a hyphen is in any other position, it is considered an invalid digit. If the phone number is valid, the main calls the AcknowledgeCall function to write the converted number to the output file. All the logic of the program should be put in functions that are called from Main(): ReadDials() and AcknowledgeCall(). The ToDigits() function is called from the ReadDials() function and is used to convert each letter entered individually into a digit and to verify that the user has entered a valid phone number. Have the program work for any number of phone numbers. In the ToDigits() function uses the toupper function to convert any letters entered to uppercase. All the error messages are to be
  • 6. written to the output file from main() based on the return value from the functions. Continue processing until the user enters a Q. You will set up the 8 char variables to hold the digits of the phone number in main() and pass the variables to the functions by reference. Sample Output from the Program Enter a phone number (Q to quit): 213-2121 Phone Number Dialed: 213-2121 Enter a phone number (Q to quit): asc-dfer Phone Number Dialed: 272-3337 Enter a phone number (Q to quit): 555-resw ERROR - Phone number cannot begin with 555 Enter a phone number (Q to quit): 098-8765 ERROR - Phone number cannot begin with 0 Enter a phone number (Q to quit): 12345678 ERROR - Hyphen is not in the correct position Enter a phone number (Q to quit): @34- *uyt ERROR - An invalid character was entered Enter a phone number (Q to quit): Q Press any key to continue . . . Step 2: Processing Logic Using the pseudocode below, write the code that will meet the requirements. Main Function Declare the char variables for the 8 digits of the phone number
  • 7. while true Call the ReadDials function passing the 8 digits by reference. ReadDials returns an error code by value. If the return value is -5, exit the do while loop If the error code is -1, display the error message "ERROR - An invalid character was entered". If the error code is -2, display the error message "ERROR - Phone number cannot begin with 0". If the error code is -3, display the error message "ERROR - Phone number cannot www,fth, begin with 55 error code is -4, r<y thi.comerror message "ERROR - Hyphen is not in the correct position". Otherwise, call the AcknowledgeCall function End-While ReadDials function Input the first digit If a Q was entered, return -5. Input the rest of the phone number Call the ToDigit function for each of the 7 digits not for digit 4 If ToDigit returns -1, return -1 If digit 4 is not a hyphen, return -4.
  • 8. If digit 1 is 0, return -2. If digits 1 - 3 are 5, return -3 Otherwise, return 0 ToDigit function Convert the digit to upper case Use a switch statement to determine if the digit is valid and convert the letters to digits If the digit is invalid, return -1. If the digit is valid, return 0. AcknowledgeCall function Display the Phone Number. www.cStep 3: Create ,a N r Projec '.- . Create a new project and name it LAB4. Write your code using the processing logic in Step 2 (above). Make sure that you save your program. Step 4: Compile and Execute a) Compile your program. Eliminate all the syntax errors. b) Build your program and verify the results of the program. Make corrections to the program logic, if necessary, until the results of the program execution are what you expect. Step 5: Print Screen Shots and Program
  • 9. Capture a screen print of your output (do a print screen and paste into an MS Word document). Copy your code and paste it into the same MS Word document that contains the screen print of your output. Save the Word document as Lab04_LastName_FirstInitial. END OF LAB www.cisl70entirecourse.com
  • 10. Capture a screen print of your output (do a print screen and paste into an MS Word document). Copy your code and paste it into the same MS Word document that contains the screen print of your output. Save the Word document as Lab04_LastName_FirstInitial. END OF LAB www.cisl70entirecourse.com