Inheritance and output formatting

Assignment Help C/C++ Programming
Reference no: EM13771980

Inheritance and Output Formatting

Please finish the implementation of class name and derived classes person and employee in the following code. Format the output neatly using setw() and or other setioflags features (Module 13).

#include

#include

using namespace std;

class name {

protected:

char *first, *last;

public:

name() {};

name(char *f, char *l)

{...}

virtual void info(){// formatted display of the information

}

};

class person : public name {

char gender;

int ssn;

public:

person() {};

person(char *f, char *l, char g, int s): gender(g), ssn(s),

name::name(f, l) {}

virtual void info() { // formatted display of the information

name::info();

... }

};

class employee : public person {

protected:

int payroll;

char *position;

public:

employee() {};

employee(char *f, char *l, char g, int s, int p, char *pos) {

...

void info() { // formatted display of the information

...

}

}

};

int main()

{

char fn[20], ln[20], pos[20];

char gen;

int s, pay;

name *worker;

for (int i=0; i<3; i++) {

}

cout << "Input the first name: " <> fn;

cout << "Input the last name: " <> ln;

cout << "Input the gender: " <> gen;

cout << "Input the social security number: " <> s;

cout << "Input the payroll: " <> pay;

cout << "Input the position: " <> pos;

worker = new employee(fn, ln, gen, s, pay, pos);

worker->info();

}

system("pause");

return 0;

Reference no: EM13771980

Questions Cloud

Batch of standard chips is converted into standard memory : In module assembly, each batch of standard chips is converted into standard memory modules at a separately identified cost of $1,000 and then sold for $8,500. Each batch of deluxe chips is converted into deluxe memory modules at a separately identifi..
Control or display in your environment : Select a control or display in your environment. Describe and evaluate it with respect to general guidelines for controls or displays. Should it be redesigned.
Current issue of consumer reports : Choose a current issue of consumer reports, money, BusinessWeek, or Kiplinger's Personal Finance and summarize an article that updates the costs of health care. How might you use this information to reduce your health care cost?
The sales and costs of producing the jigsaws : Playtime Ltd produces jigsaws for sale in model shops. The following information relates to the sales and costs of producing the jigsaws.Selling price per unit is £20Variable cost per unit is £10
Inheritance and output formatting : Inheritance and Output Formatting, finish the implementation of class name and derived classes person and employee in the following code. Format the output neatly using setw() and or other setioflags features
The demographic transition model : Describe the demographic transition model and how it was developed by demographers.
What is understanding of influence of maurice merleau-ponty : What is your understanding of the influence of Maurice Merleau-Ponty on the development of ecophenomenology as an approach to environmental ethics?
Erp system products : If you were trying to sell the purchase of an ERP system to your boss, what would you say to convince him/her of its value to your career industry?
What is your overall opinion of the course material : What is your overall opinion of the course material? Did it meet your expectations? What suggestions can you offer for improvement of this course for future students

Reviews

Write a Review

C/C++ Programming Questions & Answers

  We have to deal with student pilots

We have to deal with student pilots and airplanes. Students have a unique student id, a name, and a year that students are in. Airplanes have a unique airplane id, model, a cruising range

  Write a pseudocode statement

Assume that a program has two string variables named str1 and str2. Write a pseudocode statement that assigns an all uppercase version of str1 to the str2 variable. is str.add(str1,str2) part of it?

  Implement a function to recursively

Implement a function to recursively determine if a word is a palindrome. A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction.

  A pattern detector has an input

A pattern detector has an input a 4 x 4 matrix whose elements take values a, b, c, or d. The output is 1 if the matrix contains one b surrounded by eight a's and 0 otherwise.

  Write a program that skip s leading whitespace character

a) Write a program that skip s leading whitespace character s in each line of the pro vided data file CPPHumor .txt . Save the results in a new file

  Create a data file called friends.dat

Create a data file called friends.dat using any text-based editor and enter at least three records storing your friends' first and last names. Make sure that each field in the record is separated by a white space.

  Explain characteristics unique to object-oriented programing

The machine language treats a message as bits while object-oriented programming language treats every message as an object. Do you agree with this statement? Why or why not? Explain the characteristics unique to object-oriented programming and how..

  As more and more mobile and handheld devices

As more and more mobile and handheld devices become prolific in everyday life, many applications have been ported from a traditional PC environment to the mobile devices. Mobile devices tend to have proprietary platforms with their own unique operati..

  The above array is a declaration of an array of type integer

The above array is a declaration of an array of type integer. The name of the array is studentMark, and the array is of size 10. Arrays in C can be initialized by using a single statement that declares the array or by breaking it into two statements...

  Flipflapsthe project is to design and write a c 11fltk game

flipflapsthe project is to design and write a c 11fltk game program with a graphical user interface.the game is based

  Calculate and display the area of the rectangle

Calculate and display the area of the rectangle and the total price of the tile. Add comments in code section. Code this program in java programming.

  Called cbankaccount

Create a base class, called CBankAccount, and two additional classes (each derived from CBankAccount), called CSavingsAccount and CCheckingAccount.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd