Pep/8 & c++ @ newton 2.0

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

Get 20% Discount on The assignment
Pages (550 words)
Approximate price: -

Try it now!

Get 20% Discount on The Assignment

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

EssayBrill has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.

Essays

Essay Writing Services

At EssayBrill, we prioritize on all aspects that bring about a good grade such as impeccable grammar, proper structure, zero-plagiarism and conformance to guidelines. Our experienced team of writers will help you completed your essays and other assignments.

Admissions

Admission and Business Papers

Be assured that you’ll definitely get accepted to the Master’s level program at any university once you enter all the details in the order form. We won’t leave you here; we will also help you secure a good position in your aspired workplace by creating an outstanding resume or portfolio once you place an order.

Editing

Editing and Proofreading

Our skilled editing and writing team will help you restructure you paper, paraphrase, correct grammar and replace plagiarized sections on your paper just on time. The service is geared toward eliminating any mistakes and rather enhancing better quality.

Coursework

Technical papers

We have writers in almost all fields including the most technical fields. You don’t have to worry about the complexity of your paper. Simply enter as much details as possible in the place order section.