Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. In the Notes, OOP in C++, the following files are used to describe an introductory level object oriented program in C++. However, the files

4. In the Notes, OOP in C++, the following files are used to describe an introductory level object oriented program in C++. However, the files may not be complete. A) Implement the code below labeled thinker.h, thinker.cpp, and TestThinker.cpp as a header file, implementation file, and test program file, respectively. Modify the code, if needed to make it operate as advertised. B) Document each line of code with comments and descibe any changes you had to make to the original code to get it to work. C) Write a summary of what your final version of the program does.

You may also add white space or reorder the code to suit your own style as long as the intended function does not change.

///////// thinker.h ///////////////////

class thinking_cap

{

public:

void slots(char new_green[ ], char new_red[ ]);

void push_green( ) const;

void push_red( ) const;

private:

char green_string[50];

char red_string[50];

};

//////// thinker.cpp /////////////////////////////

#include

#include

#include "thinker.h"

void thinking_cap::slots(char new_green[ ], char new_red[ ])

{

assert(strlen(new_green) < 50);

assert(strlen(new_red) < 50);

strcpy(green_string, new_green);

strcpy(red_string, new_red);

}

void thinking_cap::push_green

{

cout << green_string << endl;

}

void thinking_cap::push_red

{

cout << red_string << endl;

}

////TestThinker.cpp /////////////////////////

#include "thinker.h"

int main( )

{

thinking_cap student;

thinking_cap fan;

student.slots( "Hello", "Goodbye");

fan.slots( "Go Cougars!", "Boo!");

student.push_green( );

fan.push_green( );

student.push_red( );

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago