CIS210 better know what you doing

profilejermy.9
module2.docx

[INSERT TITLE HERE] 3

Running head: [INSERT TITLE HERE]

[INSERT TITLE HERE]

Student Name

Allied American University

Author Note

This paper was prepared for [INSERT COURSE NAME], [INSERT COURSE ASSIGNMENT] taught by [INSERT INSTRUCTOR’S NAME].

Directions: There are two parts (I and II) to this homework assignment. Complete both in two separate files then submit both as your Module 2 Homework Assignment.

PART I:

For drawings, you may use your word-processing drawing tools, graphic applications, or scanned hand drawings and insert them in the main document. Create a zip file containing your document and source code files. Show all of your work.

1. Chapter 2 – Exercises, pages 81-82: 3(b); 7(a, b).

2. Chapter 2 – Problems, pages 82-85: 10; 12; 16; 18.

PART II:

Write a 2 page research paper (excluding the title page) on recursion. Explain the concepts discussed in the textbook using at least an example not included in the textbook. In addition to textbook, use two other resources (Wikipedia sources are not permitted) and list each resource used at the end of paper in the reference list section. Please remember that you may utilize LIRN to help you search for resources. You can visit the Academic Resource Center for a guide on how to utilize LIRN successfully.

Myst(n)=2* myst(n-1)+ myst(n-)

Definition to determine myst(4)

Take n=4 and substitute.

Myst(4)=2*myst(4-1) + myst (4-2)

=2*myst (3) + myst (2)

=2*[2*myst (2) + myst [1] + [myst (2)]

(Substitute n=3 and n=2 in the definition)

=2*[2*myst (2) + 1] + [2*myst (1) + myst (0)]

=4*[2*myst (2)] +2+ [2*1+2]

=4*[2*myst (1) + myst (0)] +2+4

=4*[2*1+2] +6

=8+8+6

=22

The value of myst (4) = 22

Chapter 2:

1. #include <iostream>

using namespace std;

int main() {

int input;

cout << "Enter an integer: ";

cin >> input;

cout << input << " is ";

if(input % 2 != 0) {

cout << "not ";

}

cout << "even" << endl;

}

2. #include <iostream>

using namespace std;

int rectArea (int len, int wid);

int main() {

     int len, wid;

       cout << "Enter the length: ";

       cin >> len;

       cout << "Enter the width: ";

       cin >> wid;

       cout << "The area of a " << len << " by " << wid << " rectangle is " << rectArea(6,10) << endl;

}

int rectArea (int len, int wid) {

       return len * wid;

}

3.