Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Replace the entire contents of your CIS022_S2016_Assignment10b your name.cpp wit

ID: 3694987 • Letter: R

Question

Replace the entire contents of your CIS022_S2016_Assignment10b your name.cpp with the contents of the given file.

#include <iostream>
#include <string>
using namespace std;

in MessageClass.h just above the class definition.

In the code section of the MessageBox() method, create code that reproduces the following results:
Put https://solano.instructure.com/courses/1306256/files/58060458/preview into the address bar and it should then ask you to download the image.


Note that output to the console if performed from within the MessageBox() method.

MessageBox() should be flexible enough to allow me to make changes to the strings in the call in the main() function and it will produce the similar, working results. Assume that the second string (the box header) will always be sufficiently smaller than the first string (box message).


Yes, there are easier ways to perform these tasks, but I want you to do it this way.

Insert your program documentation and code comments.

Provide program documentation and comment both of the files generated with the new class.

The contents of CIS022_S2016_Assignment10b.cpp are below.

Create a new project.

Visual C++

Win32 Console Application

Name the project CIS022_S2016_Assignment10b your name

Select a location where you can find it later

Choose the default application settings 2. Insert the following code into your project.

CIS022_S2016_Assignment10b.cpp The contents are provided below.

Replace the entire contents of your CIS022_S2016_Assignment10b your name.cpp with the contents of the given file.

3. Complete the project.

Make NO changes to the provided code.

Create a class named MessageClass with the following attributes: A. A public method called MessageBox that accepts three parameters: String, integer, and string.

Hint: Don't forget to include the three lines:

#include <iostream>
#include <string>
using namespace std;

in MessageClass.h just above the class definition.

B. Include 4 constants of type int in the header file that define Bonk, Question, Information and Wink so that main() can reference them in the call to MessageBox(). C. Create, initialize and use an array that holds the four emphasis characters, !, ?, i, and ; that align with the constants in Step B and the integer passed into the MessageBox() function. D.

In the code section of the MessageBox() method, create code that reproduces the following results:
Put https://solano.instructure.com/courses/1306256/files/58060458/preview into the address bar and it should then ask you to download the image.


Note that output to the console if performed from within the MessageBox() method.

MessageBox() should be flexible enough to allow me to make changes to the strings in the call in the main() function and it will produce the similar, working results. Assume that the second string (the box header) will always be sufficiently smaller than the first string (box message).


Yes, there are easier ways to perform these tasks, but I want you to do it this way.

4.

Insert your program documentation and code comments.

Provide program documentation and comment both of the files generated with the new class.

The contents of CIS022_S2016_Assignment10b.cpp are below.

  #include "stdafx.h"  #include <iostream>  #include <string>    #include "MessageClass.h"    using namespace std;    int _tmain(int argc, _TCHAR* argv[])  {            MessageClass msg;            msg.MessageBox("Welcome to CIS 022 from Mark Berrett", msg.Bonk, "Hello");            cout << endl;            msg.MessageBox("Why did the chicken cross the road", msg.Question, "Why");            cout << endl;            msg.MessageBox("To get to the other side", msg.Information, "Because");            cout << endl;            msg.MessageBox("That is all", msg.Wink, "Thank you");                              cout << endl;          system("Pause");          return 0;  }  

Explanation / Answer

MessageClass.h:

#include<string>
using namespace std;
class MessageClass
{
   public:
       int Bonk, Question, Information,Winkso;
       MessageClass();
       void MessageBox(string msg,int type,string reply);
};

MessageClass.cpp:

#include "MessageClass.h"
#include<iostream>
MessageClass::MessageClass()
{
   Bonk=0;
   Question=1;
   Information=2;
   Winkso=3;
}
void MessageClass::MessageBox(string msg,int type,string reply)
{
   if(type==Bonk)
       cout<<msg<<"! "<<reply;
   else if(type==Question)
       cout<<msg<<"? "<<reply;
   else if(type==Information)
       cout<<msg<<"i "<<reply;
   else
       cout<<msg<<"; "<<reply;
}

CIS022_S2016_Assignment10.cpp:

#include <stdafx.h>
#include <iostream>
#include <string>

#include "MessageClass.h"

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{

MessageClass msg;

msg.MessageBox("Welcome to CIS 022 from Mark Berrett", msg.Bonk, "Hello");

cout << endl;

msg.MessageBox("Why did the chicken cross the road", msg.Question, "Why");

cout << endl;

msg.MessageBox("To get to the other side", msg.Information, "Because");

cout << endl;

msg.MessageBox("That is all", msg.Wink, "Thank you");
  
  
cout << endl;
system("Pause");
return 0;
}

output:

Welcome to CIS 022 from Mark Berrett ! Hello

Why did the chicken cross the road ? Why

To get to the other side i Because

That is all ; Thank you