Question
Hello, I need help with my C++ program assignment, it's based on the book, C++ Programing 7th Edition . Background Abstraction is the performance of
Hello, I need help with my C++ program assignment, it's based on the book, C++ Programing 7th Edition.
Background
Abstraction is the performance of a task, or storage of data, by a sub-class in a manner that hides the details of what is being done from the parent class. In other words, the functions performed by methods and the data stored in members are abstracted when they are not directly accessible by the parent class and the exact nature of what they are or what they do is not public. Let me use the string class to illustrate. When you create an object of type string, you declare it much like a variable. string szFirstName; string is the class name and szFirstName is the object just created. This code creates the object by calling its constructor which, no doubt, does a whole bunch of things that we have no need to know about. When we set the "value" of szFirstName we are actually telling the class code to store the value in a character array that we do not have direct access to. The string class has methods that perform copying to and from its members when we use = to set and get the text. string also has methods that we can use to manipulate or get information about its members. For example, the .length() method will tell us how many characters a string object is holding. We cannot directly count those characters, they are hidden, but instead we call a method that tells us what we want to know. The beauty of abstraction is that you can place a whole lot of functionality into a class and move it out of the way - and include it in other programs when you need it. If you had to code all of the workings of the string class it would be hundreds of lines long. Instead, all you have to do is include the library and use the parts that you need. In this exercise you are going to roughly recreate the the MessageBox() method provided with Visual Basic.NET. You are going to add a class to existing code that will display a message, with emphasis and title text, in a box on the console. More information about abstraction is available in the Malik text in chapter 10 and the Dale text in chapter 12.. | |||||||||||||||||||||||||
Procedure |
|
-------------------------------------------------------------------------------------
Below is the code For my Main program entry.
-------------------------------------------------------------------------------------
#include "stdafx.h" #include #include #include "MessageClass.h";
using namespace std;
int _tmain(int argc, _TCHAR* argv[]) {
MessageClass msg;
msg.MessageBox("Welcome to My CIS class", msg.Bonk, "Hello");
cout
msg.MessageBox("Why did the chicken cross the road", msg.Question, "Why");
cout
msg.MessageBox("To get to the other side", msg.Information, "Because");
cout
msg.MessageBox("That is all", msg.Wink, "Thank you");
cout
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Below is my MessageClass.cpp
-------------------------------------------------------------------------------------
#include "stdafx.h" #include "MessageClass.h"
using namespace std;
void MessageClass::MessageBox(string, int, string) { }
MessageClass::MessageClass() { }
MessageClass::~MessageClass() { }
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Below is my MessageClass.h
-------------------------------------------------------------------------------------
#pragma once
#include #include
using namespace std;
class MessageClass { public:
void MessageBox(string, int, string); const int Bonk = '!'; const int Question = '?'; const int Information = 'i'; const int Wink = ';';
MessageClass(); ~MessageClass(); };
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Please help! I'm not sure what I'm doing. Fix and edit what is needed. Thank you very very much!
E 12016 Spring\022 OnlineAssignmentsl10ACIS022 S2016 Assignment10blDebugACIS022 S2016 A... O La LX Hello Welcome to CIS 022 from Mark Berrett Why Why did the chicken cross the road ii Because iiiiiiiiiiiiiiiii i To get to the other side i Thank you That is all Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started