answersLogoWhite

0


Best Answer

#include
#include
#include

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::toupper;


struct Employee
{
string getFullName()
{
return (firstName + " " + lastName);

}


string getGender()
{
if (toupper(gender) == 'M')
{
return ("Male");

}
else if (toupper(gender) == 'F')
{
return ("Female");

}
else
{
return ("Gender was not specified");

}

}



int getAge()
{
return age;

}


string getMartialStatus()
{
if (toupper(martial_status) == 'M')
{
return ("Married");

}

else if (toupper(martial_status) == 'S')
{
return ("Single");

}

else
{
return ("Martial status is not defined!");

}

}


int getNumberOfChildren()
{
return numberOfChildren;

}



string firstName;
string lastName;
char gender;
int age;
char martial_status;
int numberOfChildren;

};

int main()
{
Employee newEmployee;

cout << endl << "Enter first name: ";
getline(cin, newEmployee.firstName);

cout << endl << "Enter last name: ";
getline(cin, newEmployee.lastName);

cout << endl << "Enter gender (M for Male and F for Female): ";
cin >> newEmployee.gender;

cout << endl << "Enter age: ";
cin >> newEmployee.age;

cout << endl << "Enter martial status (M for married and S for single): ";
cin >> newEmployee.martial_status;

cout << endl << "Enter number of children: ";
cin >> newEmployee.numberOfChildren;

cout << endl << "Employee's full name: " << newEmployee.getFullName()
<< endl << "Gender: " << newEmployee.getGender()
<< endl << "Age: " << newEmployee.getAge()
<< endl << "Martial status: " << newEmployee.getMartialStatus()
<< endl << "Children: " << newEmployee.getNumberOfChildren()
<< endl;

system("PAUSE");
return 0;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a C program for the following Create a structure employee and accept its data members such as employee name and gender and age and martial status and no of children from the key board and write?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Martial arts is a violent past time and children should not practice it.?

Martial arts is a violent past time and children should not practice it.


Are children martial art classes tax deductible?

No, they are not.


What has the author Gaku Homma written?

Gaku Homma has written: 'Aikido for Life' 'Aikido sketch diary' 'Children and the martial arts' -- subject(s): Self-defense for children, Aikido, Martial arts for children


What type of sports do children play in China?

martial arts and ping pong


Where is the Brown Institute of Martial Arts located?

Brown Institute of Martial Arts is located in Dayton, Ohio. This school offers classes for young children as well as adults. You will be trained by professional martial arts instructors at this school.


How many martial arts does Gary busey know?

Gary Busey black belts in all of the following martial arts: budo-jujitsu, capoeira, hapkido, "Jailhouse Rock," and kendo.


Is children martial art dangerous?

no it isnt dangerous, it's so very important for a child to know martial arts, so they can defend themselves...just guide them, so that they will not be harmed!


What is the best martial arts studio for families?

Most likely Taekwondo or Karate, these martial arts have many families involved and most studios of these take both children and adults as students, compared to martial art styles like BJJ that may not.


How can you use martial in a sentence?

Karate is a famous martial art; the mayor declared martial law after rioting broke out.


What has the author Mark Kehl written?

Mark Kehl has written: 'Scary stories for stormy nights' -- subject(s): American Horror tales, Children's stories, American, Horror stories, Short stories 'Tournament of fear and other martial arts stories' -- subject(s): Children's stories, American, Fiction, Martial arts, Martial arts fiction, Short stories 'Scary Sea Stories Volume II (Scary Sea Stories)'


How do you use the word Martial martial in a sentence?

After the disaster, the government enacted martial law.


What Dragon Ball Z season 7 be about?

the events following the cell games saga including the Great Saiyaman and the World Martial Arts Tournament