SlideShare a Scribd company logo
Problem 1: (8 points) Run the mystery program from Fig 6.16
with the values supplied in the help solution of Pep8 and some
of your own
a) Show 3 screen shots with different inputs, including the
output using Batch I/O
b) State in one sentence, what does this program do?
c) Modify the program to make the output clearer – Describe –
Do not paste the code
Show the same 3 screen shots with the modification
d) Is this spaghetti code or structured code? If it was the other
type, would it be easier or harder to modify?
Note: Review presentation on Using Pep8 Trace Tags before
beginning the following problems.
Also, work each of these programs in steps. Get one part
working before trying to add all the requirements. If you feel
you cannot complete it, submit what you have and the last
working version. Start early and email me with problems, I will
give you hints and direction.
Problem 2:
(14 points) Translate the program below into PEP/8 assembly
language
•
Start with Assembly code for Fig 6.36 (Use Pep8 help)
•
Change to output array in same order as input
•
Add function twoVect
•
Pass array as parameter as shown in Fig 6.38
•
Use trace tags on all variables.
a) Comment lines of the source code to trace the C++ code. Cut
& paste the Source Code Listing into your assignment
document.
b) Run for a set of 4 inputs and paste a screen shot of the
Output area of PEP/8.
c) Step thru & Cut and paste the memory trace when in the
twoVect function.
#include using namespace std;
void twoVect(int v[], int n){
int k;
for(k = 0; k < n; k++){ v[k] = v[k] * 2;
}
} int main () {
int vector[4];
int j;
for (j=0; j<4; j++){
cin >> vector[j];
}
twoVect(vector, 4); for (j=0; j<4; j++){
cout << j << ' ' << vector[j] << endl;
}
return 0;
}
Problem 3: (14 points) Translate the program below into PEP/8
assembly language
•
Use a jump table to implement the switch statement.
•
Use trace tags on all variables.
•
For invalid scores, output should be the same as the C++
program.
•
Add something to the output that makes this program uniquely
yours.
•
The variable finish needs to be local.
•
This is similar to Fig 6.40.
a) Comment lines of the source code to trace the C++ code. Cut
& paste the Source Code Listing into your assignment
document.
b)
Run for each score and
paste a screen shot of each of the PEP/8 Output area.
c) Step thru & Cut and paste the memory trace at any point.
#include
using namespace std;
int main () { int finish;
cout << "Enter your score: 1, 2, 3, 4, or 5" << endl; cin >>
finish;
switch (finish) { case 1:
cout << "you're first!" << endl;
break; case 2:
cout << "you're second!" << endl;
break; case 3: case 4:
cout << "you're not first or second" << endl;
break;
default:
cout << "you weren't even competing" << endl;
}
cout << endl; return 0;
}
Problem 4: (14 points) Write a C++ program that inputs a lower
case character, converts it to an upper case character using the
function below and increments it to the next character (i.e. B
will be changed to C). If Z is entered it should be changed to A.
If a non-letter character is entered, it should not be changed.
•
A character that is not a letter should be returned as is.
•
Character variables will need character trace tags.
•
Hint: characters only use one byte of storage and should be
manipulated with byte instructions.
•
Add something to the output that makes this program uniquely
yours.
•
Then translate it to Assembly language.
a) Cut and paste you C++ Source Code into your assignment
document.
b) Comment lines of the source code to trace the C++ code. Cut
& paste the Assembly Source Code Listing into your assignment
document.
c) Run for 3 inputs: one uppercase, one lowercase, & one non-
letter and paste a screen shot of each in the Output area of the
PEP/8.
d) Step thru & Cut and paste the memory trace at a point when
in
uppercase
subroutine.
char uppercase (char ch) { if ((ch >= 'a') && (ch <= 'z')) {
return ch - 'a' + 'A';
} else { return ch;
}
}

More Related Content

Similar to Problem 1 (8 points) Run the mystery program from Fig 6.16 with.docx

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
 
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docxCOMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docxdonnajames55
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance levelsajjad ali khan
 
Gsp 215 Believe Possibilities / snaptutorial.com
Gsp 215  Believe Possibilities / snaptutorial.comGsp 215  Believe Possibilities / snaptutorial.com
Gsp 215 Believe Possibilities / snaptutorial.comStokesCope20
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 manjurkts
 
Gsp 215 Effective Communication / snaptutorial.com
Gsp 215  Effective Communication / snaptutorial.comGsp 215  Effective Communication / snaptutorial.com
Gsp 215 Effective Communication / snaptutorial.comHarrisGeorg21
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17manjurkts
 
Gsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comGsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comrobertleew18
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programmingWondeson Emeye
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comWilliamsTaylorza48
 
Cmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comStephenson22
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
Cmis 102 Effective Communication / snaptutorial.com
Cmis 102  Effective Communication / snaptutorial.comCmis 102  Effective Communication / snaptutorial.com
Cmis 102 Effective Communication / snaptutorial.comHarrisGeorg12
 

Similar to Problem 1 (8 points) Run the mystery program from Fig 6.16 with.docx (20)

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
 
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docxCOMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
Gsp 215 Believe Possibilities / snaptutorial.com
Gsp 215  Believe Possibilities / snaptutorial.comGsp 215  Believe Possibilities / snaptutorial.com
Gsp 215 Believe Possibilities / snaptutorial.com
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
 
P3
P3P3
P3
 
Gsp 215 Effective Communication / snaptutorial.com
Gsp 215  Effective Communication / snaptutorial.comGsp 215  Effective Communication / snaptutorial.com
Gsp 215 Effective Communication / snaptutorial.com
 
C programming
C programmingC programming
C programming
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17
 
Intro
IntroIntro
Intro
 
Gsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comGsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.com
 
LAB 1 Report.docx
LAB 1 Report.docxLAB 1 Report.docx
LAB 1 Report.docx
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.com
 
Cmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.com
 
C programming language
C programming languageC programming language
C programming language
 
Lesson 4.1 completing the problem solving process
Lesson 4.1 completing the problem solving processLesson 4.1 completing the problem solving process
Lesson 4.1 completing the problem solving process
 
Cmis 102 Effective Communication / snaptutorial.com
Cmis 102  Effective Communication / snaptutorial.comCmis 102  Effective Communication / snaptutorial.com
Cmis 102 Effective Communication / snaptutorial.com
 
C programming
C programmingC programming
C programming
 

More from dessiechisomjj4

Project 2 Research Paper Compendium                               .docx
Project 2 Research Paper Compendium                               .docxProject 2 Research Paper Compendium                               .docx
Project 2 Research Paper Compendium                               .docxdessiechisomjj4
 
Project 1 Interview Essay Conduct a brief interview with an Asian.docx
Project 1 Interview Essay Conduct a brief interview with an Asian.docxProject 1 Interview Essay Conduct a brief interview with an Asian.docx
Project 1 Interview Essay Conduct a brief interview with an Asian.docxdessiechisomjj4
 
Project 1 Scenario There is a Top Secret intelligence report.docx
Project 1 Scenario There is a Top Secret intelligence report.docxProject 1 Scenario There is a Top Secret intelligence report.docx
Project 1 Scenario There is a Top Secret intelligence report.docxdessiechisomjj4
 
Project #1 Personal Reflection (10)Consider an opinion that you .docx
Project #1 Personal Reflection (10)Consider an opinion that you .docxProject #1 Personal Reflection (10)Consider an opinion that you .docx
Project #1 Personal Reflection (10)Consider an opinion that you .docxdessiechisomjj4
 
Project 1 Chinese Dialect Exploration and InterviewYou will nee.docx
Project 1 Chinese Dialect Exploration and InterviewYou will nee.docxProject 1 Chinese Dialect Exploration and InterviewYou will nee.docx
Project 1 Chinese Dialect Exploration and InterviewYou will nee.docxdessiechisomjj4
 
Project 1 (1-2 pages)What are the employee workplace rights mand.docx
Project 1 (1-2 pages)What are the employee workplace rights mand.docxProject 1 (1-2 pages)What are the employee workplace rights mand.docx
Project 1 (1-2 pages)What are the employee workplace rights mand.docxdessiechisomjj4
 
PROGRAM 1 Favorite Show!Write an HLA Assembly program that displa.docx
PROGRAM 1 Favorite Show!Write an HLA Assembly program that displa.docxPROGRAM 1 Favorite Show!Write an HLA Assembly program that displa.docx
PROGRAM 1 Favorite Show!Write an HLA Assembly program that displa.docxdessiechisomjj4
 
Program must have these things Format currency, total pieces & e.docx
Program must have these things Format currency, total pieces & e.docxProgram must have these things Format currency, total pieces & e.docx
Program must have these things Format currency, total pieces & e.docxdessiechisomjj4
 
Professors Comments1) Only the three body paragraphs were require.docx
Professors Comments1) Only the three body paragraphs were require.docxProfessors Comments1) Only the three body paragraphs were require.docx
Professors Comments1) Only the three body paragraphs were require.docxdessiechisomjj4
 
Program EssayPlease answer essay prompt in a separate 1-page file..docx
Program EssayPlease answer essay prompt in a separate 1-page file..docxProgram EssayPlease answer essay prompt in a separate 1-page file..docx
Program EssayPlease answer essay prompt in a separate 1-page file..docxdessiechisomjj4
 
Program Computing Project 4 builds upon CP3 to develop a program to .docx
Program Computing Project 4 builds upon CP3 to develop a program to .docxProgram Computing Project 4 builds upon CP3 to develop a program to .docx
Program Computing Project 4 builds upon CP3 to develop a program to .docxdessiechisomjj4
 
Project 1 Resource Research and ReviewNo directly quoted material.docx
Project 1 Resource Research and ReviewNo directly quoted material.docxProject 1 Resource Research and ReviewNo directly quoted material.docx
Project 1 Resource Research and ReviewNo directly quoted material.docxdessiechisomjj4
 
Professionalism Assignment I would like for you to put together yo.docx
Professionalism Assignment I would like for you to put together yo.docxProfessionalism Assignment I would like for you to put together yo.docx
Professionalism Assignment I would like for you to put together yo.docxdessiechisomjj4
 
Professor Drebins Executive MBA students were recently discussing t.docx
Professor Drebins Executive MBA students were recently discussing t.docxProfessor Drebins Executive MBA students were recently discussing t.docx
Professor Drebins Executive MBA students were recently discussing t.docxdessiechisomjj4
 
Professional Legal Issues with Medical and Nursing Professionals  .docx
Professional Legal Issues with Medical and Nursing Professionals  .docxProfessional Legal Issues with Medical and Nursing Professionals  .docx
Professional Legal Issues with Medical and Nursing Professionals  .docxdessiechisomjj4
 
Prof Washington, ScenarioHere is another assignment I need help wi.docx
Prof Washington, ScenarioHere is another assignment I need help wi.docxProf Washington, ScenarioHere is another assignment I need help wi.docx
Prof Washington, ScenarioHere is another assignment I need help wi.docxdessiechisomjj4
 
Prof James Kelvin onlyIts just this one and simple question 1.docx
Prof James Kelvin onlyIts just this one and simple question 1.docxProf James Kelvin onlyIts just this one and simple question 1.docx
Prof James Kelvin onlyIts just this one and simple question 1.docxdessiechisomjj4
 
Product life cycle for album and single . sales vs time ( 2 pa.docx
Product life cycle for album and single . sales vs time ( 2 pa.docxProduct life cycle for album and single . sales vs time ( 2 pa.docx
Product life cycle for album and single . sales vs time ( 2 pa.docxdessiechisomjj4
 
Produce the following components as the final draft of your health p.docx
Produce the following components as the final draft of your health p.docxProduce the following components as the final draft of your health p.docx
Produce the following components as the final draft of your health p.docxdessiechisomjj4
 
Produce a preparedness proposal the will recommend specific steps th.docx
Produce a preparedness proposal the will recommend specific steps th.docxProduce a preparedness proposal the will recommend specific steps th.docx
Produce a preparedness proposal the will recommend specific steps th.docxdessiechisomjj4
 

More from dessiechisomjj4 (20)

Project 2 Research Paper Compendium                               .docx
Project 2 Research Paper Compendium                               .docxProject 2 Research Paper Compendium                               .docx
Project 2 Research Paper Compendium                               .docx
 
Project 1 Interview Essay Conduct a brief interview with an Asian.docx
Project 1 Interview Essay Conduct a brief interview with an Asian.docxProject 1 Interview Essay Conduct a brief interview with an Asian.docx
Project 1 Interview Essay Conduct a brief interview with an Asian.docx
 
Project 1 Scenario There is a Top Secret intelligence report.docx
Project 1 Scenario There is a Top Secret intelligence report.docxProject 1 Scenario There is a Top Secret intelligence report.docx
Project 1 Scenario There is a Top Secret intelligence report.docx
 
Project #1 Personal Reflection (10)Consider an opinion that you .docx
Project #1 Personal Reflection (10)Consider an opinion that you .docxProject #1 Personal Reflection (10)Consider an opinion that you .docx
Project #1 Personal Reflection (10)Consider an opinion that you .docx
 
Project 1 Chinese Dialect Exploration and InterviewYou will nee.docx
Project 1 Chinese Dialect Exploration and InterviewYou will nee.docxProject 1 Chinese Dialect Exploration and InterviewYou will nee.docx
Project 1 Chinese Dialect Exploration and InterviewYou will nee.docx
 
Project 1 (1-2 pages)What are the employee workplace rights mand.docx
Project 1 (1-2 pages)What are the employee workplace rights mand.docxProject 1 (1-2 pages)What are the employee workplace rights mand.docx
Project 1 (1-2 pages)What are the employee workplace rights mand.docx
 
PROGRAM 1 Favorite Show!Write an HLA Assembly program that displa.docx
PROGRAM 1 Favorite Show!Write an HLA Assembly program that displa.docxPROGRAM 1 Favorite Show!Write an HLA Assembly program that displa.docx
PROGRAM 1 Favorite Show!Write an HLA Assembly program that displa.docx
 
Program must have these things Format currency, total pieces & e.docx
Program must have these things Format currency, total pieces & e.docxProgram must have these things Format currency, total pieces & e.docx
Program must have these things Format currency, total pieces & e.docx
 
Professors Comments1) Only the three body paragraphs were require.docx
Professors Comments1) Only the three body paragraphs were require.docxProfessors Comments1) Only the three body paragraphs were require.docx
Professors Comments1) Only the three body paragraphs were require.docx
 
Program EssayPlease answer essay prompt in a separate 1-page file..docx
Program EssayPlease answer essay prompt in a separate 1-page file..docxProgram EssayPlease answer essay prompt in a separate 1-page file..docx
Program EssayPlease answer essay prompt in a separate 1-page file..docx
 
Program Computing Project 4 builds upon CP3 to develop a program to .docx
Program Computing Project 4 builds upon CP3 to develop a program to .docxProgram Computing Project 4 builds upon CP3 to develop a program to .docx
Program Computing Project 4 builds upon CP3 to develop a program to .docx
 
Project 1 Resource Research and ReviewNo directly quoted material.docx
Project 1 Resource Research and ReviewNo directly quoted material.docxProject 1 Resource Research and ReviewNo directly quoted material.docx
Project 1 Resource Research and ReviewNo directly quoted material.docx
 
Professionalism Assignment I would like for you to put together yo.docx
Professionalism Assignment I would like for you to put together yo.docxProfessionalism Assignment I would like for you to put together yo.docx
Professionalism Assignment I would like for you to put together yo.docx
 
Professor Drebins Executive MBA students were recently discussing t.docx
Professor Drebins Executive MBA students were recently discussing t.docxProfessor Drebins Executive MBA students were recently discussing t.docx
Professor Drebins Executive MBA students were recently discussing t.docx
 
Professional Legal Issues with Medical and Nursing Professionals  .docx
Professional Legal Issues with Medical and Nursing Professionals  .docxProfessional Legal Issues with Medical and Nursing Professionals  .docx
Professional Legal Issues with Medical and Nursing Professionals  .docx
 
Prof Washington, ScenarioHere is another assignment I need help wi.docx
Prof Washington, ScenarioHere is another assignment I need help wi.docxProf Washington, ScenarioHere is another assignment I need help wi.docx
Prof Washington, ScenarioHere is another assignment I need help wi.docx
 
Prof James Kelvin onlyIts just this one and simple question 1.docx
Prof James Kelvin onlyIts just this one and simple question 1.docxProf James Kelvin onlyIts just this one and simple question 1.docx
Prof James Kelvin onlyIts just this one and simple question 1.docx
 
Product life cycle for album and single . sales vs time ( 2 pa.docx
Product life cycle for album and single . sales vs time ( 2 pa.docxProduct life cycle for album and single . sales vs time ( 2 pa.docx
Product life cycle for album and single . sales vs time ( 2 pa.docx
 
Produce the following components as the final draft of your health p.docx
Produce the following components as the final draft of your health p.docxProduce the following components as the final draft of your health p.docx
Produce the following components as the final draft of your health p.docx
 
Produce a preparedness proposal the will recommend specific steps th.docx
Produce a preparedness proposal the will recommend specific steps th.docxProduce a preparedness proposal the will recommend specific steps th.docx
Produce a preparedness proposal the will recommend specific steps th.docx
 

Recently uploaded

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya - UEM Kolkata Quiz Club
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
ppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesashishpaul799
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...Nguyen Thanh Tu Collection
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxakshayaramakrishnan21
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resourcesaileywriter
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTechSoup
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringDenish Jangid
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticspragatimahajan3
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfDr. M. Kumaresan Hort.
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 

Recently uploaded (20)

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
ppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyes
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 

Problem 1 (8 points) Run the mystery program from Fig 6.16 with.docx

  • 1. Problem 1: (8 points) Run the mystery program from Fig 6.16 with the values supplied in the help solution of Pep8 and some of your own a) Show 3 screen shots with different inputs, including the output using Batch I/O b) State in one sentence, what does this program do? c) Modify the program to make the output clearer – Describe – Do not paste the code Show the same 3 screen shots with the modification d) Is this spaghetti code or structured code? If it was the other type, would it be easier or harder to modify? Note: Review presentation on Using Pep8 Trace Tags before beginning the following problems. Also, work each of these programs in steps. Get one part working before trying to add all the requirements. If you feel you cannot complete it, submit what you have and the last working version. Start early and email me with problems, I will give you hints and direction. Problem 2: (14 points) Translate the program below into PEP/8 assembly language • Start with Assembly code for Fig 6.36 (Use Pep8 help) • Change to output array in same order as input • Add function twoVect • Pass array as parameter as shown in Fig 6.38 • Use trace tags on all variables.
  • 2. a) Comment lines of the source code to trace the C++ code. Cut & paste the Source Code Listing into your assignment document. b) Run for a set of 4 inputs and paste a screen shot of the Output area of PEP/8. c) Step thru & Cut and paste the memory trace when in the twoVect function. #include using namespace std; void twoVect(int v[], int n){ int k; for(k = 0; k < n; k++){ v[k] = v[k] * 2; } } int main () { int vector[4]; int j; for (j=0; j<4; j++){ cin >> vector[j]; } twoVect(vector, 4); for (j=0; j<4; j++){ cout << j << ' ' << vector[j] << endl; } return 0; } Problem 3: (14 points) Translate the program below into PEP/8 assembly language • Use a jump table to implement the switch statement. • Use trace tags on all variables. • For invalid scores, output should be the same as the C++ program. • Add something to the output that makes this program uniquely yours.
  • 3. • The variable finish needs to be local. • This is similar to Fig 6.40. a) Comment lines of the source code to trace the C++ code. Cut & paste the Source Code Listing into your assignment document. b) Run for each score and paste a screen shot of each of the PEP/8 Output area. c) Step thru & Cut and paste the memory trace at any point. #include using namespace std; int main () { int finish; cout << "Enter your score: 1, 2, 3, 4, or 5" << endl; cin >> finish; switch (finish) { case 1: cout << "you're first!" << endl; break; case 2: cout << "you're second!" << endl; break; case 3: case 4: cout << "you're not first or second" << endl; break; default: cout << "you weren't even competing" << endl; } cout << endl; return 0; } Problem 4: (14 points) Write a C++ program that inputs a lower case character, converts it to an upper case character using the function below and increments it to the next character (i.e. B will be changed to C). If Z is entered it should be changed to A. If a non-letter character is entered, it should not be changed. • A character that is not a letter should be returned as is.
  • 4. • Character variables will need character trace tags. • Hint: characters only use one byte of storage and should be manipulated with byte instructions. • Add something to the output that makes this program uniquely yours. • Then translate it to Assembly language. a) Cut and paste you C++ Source Code into your assignment document. b) Comment lines of the source code to trace the C++ code. Cut & paste the Assembly Source Code Listing into your assignment document. c) Run for 3 inputs: one uppercase, one lowercase, & one non- letter and paste a screen shot of each in the Output area of the PEP/8. d) Step thru & Cut and paste the memory trace at a point when in uppercase subroutine. char uppercase (char ch) { if ((ch >= 'a') && (ch <= 'z')) { return ch - 'a' + 'A'; } else { return ch; } }