PRG/411 Week 1 - Individual Assignment - C++ Review Worksheet - A+ & Original Guaranteed from an A+ rated tutor!

profileAlgebraExpert
 (Not rated)
 (Not rated)
Chat

PRG/411 Week 1 - Individual Assignment - C++ Review Worksheet - A+ & Original Guaranteed from an A+ rated tutor!

 

Directions: Answer the following questions.

 

Data Types

 

1.     What data type would you use to store the following types of data?

a.     Company address  

b.    Company revenues 

c.     Number of employees 

d.    Answer to a yes or no question 

 

Variables and Constants

 

2.     How is a variable different from a constant?

 

 

 

Arithmetic Operations

 

3.     How would you assign the following formula to a variable called payment?

 

 

Boolean Operations

 

  1. What is the Boolean result of the following logical expressions (truth tables)?

a.     True AND True 

b.    True AND False  

c.     False AND False 

d.    True OR True

e.     True OR False 

f.     True AND NOT True 

g.    True AND NOT False 

 

Selection Structures

 

  1. If bool variable “done” = false, what is the output given the following selection structures?

a.     if (done)

cout << “You are done”;

 

 

 

b.    if (done)

{

cout << “You are done”;

}

else

{

cout << “You are not done”;

}

 

 

c.     if (!done)

{

cout << “You are done”;

}

else

{

cout << “You are not done”;

}

 

                  

Repetition Structures

 

  1. What is the first and last value printed on these blocks of code?

a.     bool done = true;

int count = 0;

while (!done)

{

      cout << “Printing “<< count;

      count ++;

      if (count > 10)

         done = true;

}

 

 

b.    bool done = false;

int count = 5;

do

{

      cout << “Printing “<< count;

      count ++;

      if (count > 10)

         done = true;

}

while (!done);

 

 

 

Functions

 

  1. Given the following functions

a.     double add(double firstNumber, double secondNumber)

b.    int add(int firstNumber, int secondNumber)

c.     double doubleAdd (double firstNumber, double secondNumber)

d.    int intAdd (int firstNumber, int secondNumber)

 

Which function would be called for in the following statements:

a.     double myNumber = add(1.0, 3.0);

 

 

b.    double myNumber = add(1,3);

 

 

Arrays

 

  1. What output is produced by the following block of code?

int numbers[] = {5,4,3,2,1};

for (int x = 1; x<=5; x++)

{

            cout << “Printing “ << numbers[x];

}

 

 

Basics of Classes

 

  1. Given the following lines of code

 

1: class BankAccount

2: {

3:

4:    public:

5:       BankAccount(double initialBalance);

6:       double getBalance();

7:       void makeWithdrawl(double amount);

8:       void makeDeposit(double amount);

9:

10:   private:

11:      double currentBalance;

12: };

 

Which lines correspond with the following members:

a.     Accessor member function --

b.    Mutator member function -- 

c.     Constructor -- 

d.    Member variable -- 

e.     Class name --

 

f.     Start of public Section -- 

 

Original, cited, no plagiarism

Use as a guide! 

 

If you purchase this: Thanks for purchasing my tutorial! Open the attached file to get the paper/solutions. If you have any questions, comments, or concerns, please let me know! I can help you with future courses. Thanks again! Free feel to PM me, or send me a message at:

 

algebraexpert @ homeworkmarket.com

    • 12 years ago
    PRG/411 Week 1 - Individual Assignment - C++ Review Worksheet - A+ & Original Guaranteed from an A+ rated tutor!
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      prg_411_week_1_individual_assignment_-_c_review.docx