This is my assignment
I have to send it today
and this week I have many test and I did not any time for solve it
please
please I need help
ITCS102
Assignment #5(chapter 12)

Create a class called Employee that maintains information about an employee in a company, each employee has the following data members:
1. CPR, // long int
2. name, // string
3. salary // double
4. position // string
5. birth_date // struct Date that holds int day, int month, int year

Your class should define the following function
1. Constructor function with default values CPR = 0, name = “”, salary = 0, position=””, birth_date={0,0,0}
2. Set and get functions for all data members.
3. Overloaded functions for setBirthDate one that takes a birth_date as parameter and the other one takes int,int,int for birth_date.
4. InputData // asks the user to enter all the details of an employee and assign the values to the data members
5. outputData// Print the details (CPR, name, salary, position, birth_date) of an employee.


Part A:
Write the class Employee including the code of all member functions.


Part B:
Write a function search that receives an array of employees , it’s size and a key value representing a CPR number, the function should check if any of the employees in the array holds the passed CPR . The prototype of the function is:
int search ( Employee A[], int size, int key);

Part C:
Write a main function which includes the following:
1. Defines an array called employee_list to hold the information about the employees of a company
2. makes a loop to enter the information about 5 employees and save them in the array.
3. Asks the user to enter a CPR number and call the search function to check if it represents a valid employee.
4. if the employee is valid, allow the user to update his salary by calling the setSalary function
5. displays all old employees who were born in the year 1965 or before.
6. displays all managers in the company.

Recommended Answers

All 7 Replies

#include <iostream>
#include<string>
using namespace std;
struct Date
{
	int day;
	int month;
	int year;
};
class employee
{
    long CPR;
    string name;
	double salary;
	string position ;
	Date birthdate;
employee(long cpr=0,string name="",double salary=0,string position="",Date x=0);
void steCPR(long CPR);
void setname(string name);
void setsalary(double salary);
void setBirthDate(Date a);
void setBirthDate(int,int,int);
long getCPR();
string getname();
double getsalary();
date& getdate();
void InputDetails();
void printDetails();
};




empleyee::employee(long cpr,string name,double salary,string position,Date x)
{
CPR=cpr;
name=name;
salary=salary;
position=position;
birthdate=x;
}

void empleyee::steCPR(long cpr)
{
	CPR=cpr;
}
void empleyee::setname(string name)
{
	name=name;
}

void empleyee::setsalary(double salary)
{
	salary=salary;
}

void empleyee::setBirthDate(Date a)
{
	birthdate.day=a.day;
	birthdate.month=a.month;
	birthdate.year=a.year;
}
void empleyee::setBirthDate(int Day,int Month,int Year)
{
	birthdate.day=Day;
	birthdate.month=Month;
	birthdate.year=Year;
}

long empleyee::getCPR()
{
	return CPR;
}
string empleyee::getname()
{
	return name;
}
double empleyee::getsalary()
{
	return salary;
}
date& empleyee::getdate()
{
	return birthdate;
}

void InputDetails()
{
	cout<<"Enter the CPR number:"
	cin>>CPR;
	cout<<endl;
	cout<<"Enter your name:";
	cin>>name;
	cout<<endl;
	cout<<"Enter the salary:";
	cin>>salary;
	cout<<endl;
	cout<<"Enter the position:";
	cin>>position;
	cout<<endl;
	cout<<"Enter Your Birthday:";
	cin>>birthdate.day;
	cout<<"birthmonth:";
	cin>>birthdate.month;
	cout<<"birthyear:";
	cin>>birthdate.year;
}

void printDetails()
{
cout<<"CPR number:"
	cout<<CPR;
	cout<<endl;
	cout<<"your name:";
	cout<<name;
	cout<<endl;
	cout<<"The salary:";
	cout<<salary;
	cout<<endl;
	cout<<"The position:";
	cout<<position;
	cout<<endl;
	cout<<"Your Birthday:";
	cout<<birthdate.day;
	cout<<"Birthmonth:";
	cout<<birthdate.month;
	cout<<"Birthyear:";
	cout<<birthdate.year;

}
int search ( Employee A[], int size, int key)
{
}
int main()
{
	bool found=true;
	bool flag=false;
	int CPR;
	employee arr[10];
	for(int j=0;j<5:j++)
	{
		employee.inputdetails()=arr[j];
	return 0;
	}

This my try and it is not compleet
after 12 hours I have to send it
helllllllllllllp

if you tell us that in which part you're facing a problem or if there's some compilation error we might be able to help you.

part b and part c I do not now how to sole them
pleeeez if any body can solve it pleez do it
I do not have any time it is only 2 hours
:(
:"(

>I do not have any time it is only 2 hours
I guess you're learning the lesson of getting your work done on time because nobody is interested in doing it for you.

Part B:

int search ( Employee A[], int size, int key)
{
	for loop
		if stactement to check if CPR number is the same as key
			return the number where its stored
	return an number thats invalid (employee not found) eg. -1
}

You should be able to get B and C done now...

Thanks
I have done it
ohhhhhhhhhh
Finally
I will go to sleeeeeeeeeeeeep

>Thanks
>I have done it
That's a shame. It's more instructive to get a failing grade if you ever resort to begging for code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.