Question: Problem 3.2(15 points) In the Notes, OOP in C++, the following files are used to describe an introductory level object oriented program in C++. However,

Problem 3.2(15 points) 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. Implement the code as a header file, implementation file, and test program file. Modify the code, if needed to make it operate as advertised. Follow the usual submission rules with your code in .cpp and .h files.

Note: I am trying to do this using 3 files in my project space. The code is not working and needs to be modified. There are several aswers of a questions like this in chegg but when running the code is not working. WHAT IS WRONG WITH MY CODE, HOW CAN I FIX IT TO PRINT , hello , go cougars goodbye. Thanks

///////// 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!