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

Please create your own C++ program with the following instructions: Design a cla

ID: 3700414 • Letter: P

Question

Please create your own C++ program with the following instructions:

Design a class Heading that has data members to hold the company name and the

report name. A two-parameter deafult constructor should allow these to be specified at

the time a new Heading object is created. if the user creates a Heading object without

passing any arfuments, "ABC industries" should be used as a default value for the

company name and "Report" should be used as a default for the report name. The class

should have member functions to print a heading in either one-line format, as shown here:

Pet Pals Payroll Report

or in four-line "boxed" format, as shown here:

******************************************************************

Pet Pals

Payroll Report

*****************************************************************

Try to figure out a way to center the headings on the screen, based on their lenghts.

Demostrate the class by writing a simple program that uses it

Explanation / Answer

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

class Heading
{
private:
string company ,report;
public:
Heading();
Heading(string c, string r);
void printBoxed();
void printoneLine();
};
Heading::Heading()
{

company="ABC industries";
report="Report";
}
Heading::Heading(string c, string r)
{
company = c;
report = r;
}
void Heading::printoneLine()
{
cout<<company<<" "<<report;
}
void Heading::printBoxed()
{
cout<<"*************************************************** ";
cout<<" company ";
cout<<" report ";
}
void main()
{
Heading h;
h.printoneLine();
h.printBoxed();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote