SlideShare ist ein Scribd-Unternehmen logo
1 von 4
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;
}
}

Weitere ähnliche Inhalte

Ähnlich wie 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 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comStephenson22
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comWilliamsTaylorza48
 
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
 

Ähnlich wie 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 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.com
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

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
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
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
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
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
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
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
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 

Kürzlich hochgeladen (20)

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
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
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
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
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Ữ Â...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
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
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

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; } }