Skip to main content

cs304 Assignment 2 Solution 2021

 

         

              cs304 Assignment 2 Solution 2021

#include<iostream>

#include<conio.h>

using namespace std;

int id=200204641,i=0;

class Person

{

private:

string FirstName;

string LastName;

int PersonalId;

double Salary;

public:

void set_FirstName(string fn);

void set_LastName(string ln);

void set_PersonalId(int z);

void set_Salary(double sal);

string get_FirstName();

string get_LastName();

int get_PersonalId();

double get_Salary();

};

class HRM

{

private:

Person p[15];

public:

void AddPerson();

void DeletePerson();

void UpdatePerson();

};

void Person::set_FirstName(string fn)

{

FirstName = fn;

}

void Person::set_LastName(string ln)

{

LastName = ln;

}

void Person::set_PersonalId(int z)

{

PersonalId = z;

}

void Person::set_Salary(double sal)

{

Salary = sal;

}

string Person::get_FirstName()

{

return FirstName;

}

string Person::get_LastName()

{

return LastName;

}

int Person::get_PersonalId()

{

return PersonalId;

}

double Person::get_Salary()

{

return Salary;

}

void HRM::AddPerson()

{

string fn,ln;

double sal;

cout<<"\n\n First Name : ";

cin>>fn;

p[i].set_FirstName(fn);

cout<<" Last Name : ";

cin>>ln;

p[i].set_LastName(ln);

p[i].set_PersonalId(id);

id++;

cout<<" How much is his/her Salary? =";

cin>>sal;

p[i].set_Salary(sal);

i++;

cout<<"\n\n New employee information added in the system";

cout<<"\n\n First Name     Last Name     Personal ID     Salary per year (Rupees)";

cout<<"\n -----------  ------------- ---------------    -----------------------";

for(int a=0;a<i;a++)

{

cout<<"\n "<<p[a].get_FirstName()<<"          "<<p[a].get_LastName()<<"          "<<p[a].get_PersonalId()<<"               "<<p[a].get_Salary();

}

}

void HRM::DeletePerson()

{

int t_id;

char x;

cout<<"\n\n ID of Employee to Remove : ";

cin>>t_id;

cout<<"\n Do you want to really delete employee (Y,N) : ";

cin>>x;

if(x == 'Y' || x == 'y')

{

for(int a=0;a<i;a++)

{

if(p[a].get_PersonalId() == t_id)

{

for(int k=a;k<i;k++)

{

p[k].set_FirstName(p[k+1].get_FirstName());

p[k].set_LastName(p[k+1].get_LastName());

p[k].set_PersonalId(p[k+1].get_PersonalId());

p[k].set_Salary(p[k+1].get_Salary());

}

cout<<"\n\n Delete employee information from the system";

i--;

}

}

}

cout<<"\n\n First Name     Last Name     Personal ID     Salary per year (Rupees)";

cout<<"\n -----------  ------------- ---------------    -----------------------";

for(int a=0;a<i;a++)

{

cout<<"\n "<<p[a].get_FirstName()<<"          "<<p[a].get_LastName()<<"          "<<p[a].get_PersonalId()<<"               "<<p[a].get_Salary();

}

}

void HRM::UpdatePerson()

{

int t_id,x;

double sal;

char choice;

string fn,ln;

cout<<"\n\n Employee ID for modify information : ";

cin>>t_id;

do{

cout<<"\n\n1=> First Name";

cout<<"\n 2=> Last Name";

cout<<"\n 3=> Salary";

cout<<"\n\n Number of Field for modify : ";

cin>>x;

for(int a=0;a<i;a++)

{

if(p[a].get_PersonalId() == t_id)

{

if(x == 1)

{

cout<<"\n First Name : ";

cin>>fn;

p[a].set_FirstName(fn);

}

else if(x == 2)

{

cout<<"\n Last Name : ";

cin>>ln;

p[a].set_LastName(ln);

}

else if(x == 3)

{

cout<<"\n Salary : ";

cin>>sal;

p[a].set_Salary(sal);

}

cout<<"\n\n Modify employee information from the system";

}

}

cout<<"\n\n Do you want modify another field (Y,N) : ";

cin>>choice;

}while(choice == 'Y' || choice == 'y');

cout<<"\n\n First Name     Last Name     Personal ID     Salary per year (Rupees)";

cout<<"\n -----------  ------------- ---------------    -----------------------";

for(int a=0;a<i;a++)

{

cout<<"\n "<<p[a].get_FirstName()<<"          "<<p[a].get_LastName()<<"          "<<p[a].get_PersonalId()<<"               "<<p[a].get_Salary();

}

}

main()

{

HRM obj;

int choice;

char x;

p:

cout<<"\n\n\t1. Add New Employee";

cout<<"\n\t2. Delete Employee Information";

cout<<"\n\t3. Update Employee Information";

cout<<"\n\t4. Quit";

cout<<"\n\n\tEnter Your Choice : ";

cin>>choice;

switch(choice)

{

case 1:

cout<<"\n\n Enter the information of the new employee";

do{

obj.AddPerson();

cout<<"\n\n Do you want to add another employee (Y,N) : ";

cin>>x;

}while(x == 'Y' || x == 'y');

break;

case 2:

obj.DeletePerson();

break;

case 3:

obj.UpdatePerson();

break;

case 4:

exit(0);

default:

cout<<"\n\n\tInvalid Value...Please Try Again...";

}

goto p;

}

PURPOSE OF VUPORTAL865.COM

Virtual university is Providing quality of Education in Pakistan and Overseas too. Thousands of Students getting quality education. Virtual University of Pakistan is first university In Pakistan that providing online education to everyone in Pakistan. in this university online Education is easy and Affordable for everyone.

Most students find trouble scheduling time for their assignments since the research work is a time-consuming activity. Even so, others find trouble writing their assignment due to a lack of writing skills. Such students need to worry no more since there are several available online assignment help websites. As such, this article provides the top 10 most trusted online assignment help websites that ensure that students get the best out of their assignment help services.

We take your assignments with paramount importance as happy students are our primary goal. Our services are the most affordable, trustworthy and cover a lot of subjects.

Assignment Submission Instruction

Please read the following instructions carefully before submitting the assignment:
It should be clear that your assignment will not get 0 if:

Ø  The assignment is submitted after the due date.

Ø  The submitted assignment file is corrupt or does not open.

Ø  Assignment is copied from any where like any student or from internet.

How to Submitted Assignment:

Ø Download a question File of the Assignments on LMS.

Ø Solve a question and make a file own words.

Ø Save an Answer file in which extension who Instructor Told.

Ø Go to the LMS and Click the Books Code which you can make a solution file.

Ø Go to the Submitted Option and Click the Chose File Button.

Ø File chose where you can Save the File.

Ø After chose the File last step click the Submitted Option.

 

 

For Paid  Assignments Solution

Contact us on WhatsApp

MR Ammar(Developer)    +923235459470

MR Atif (Blogger)         +923086278790

MR Umar  (WordPress Expert)    +923053183537

Mam Farah(Assignment Expert)     +994409089591 

 

FOR ALL ASSIGNMENTS VISIT THE WEBSITE BELOW

CLICK HERE

 

 


Comments

Post a Comment

Popular posts from this blog

cs610

                                                                cs610

Cs506 Assignment 2 solution Spring 2021

  Contact us for paid Assignment  MR Ammar(Developer)    +923235459470 MR Atif (Blogger)         +923086278790 Mam Farah(Assignment Expert)     +994409089591  Download

Sta Grand Quiz By Riz Mughal

MID-GRAND-QUIZ  Download PURPOSE OF VUPORTAL865.COM Virtual university is Providing quality of Education in Pakistan and Overseas too. Thousands of Students getting quality education. Virtual University of Pakistan is first university In Pakistan that providing online education to everyone in Pakistan. in this university online Education is easy and Affordable for everyone. Most students find trouble scheduling time for their assignments since the research work is a time-consuming activity. Even so, others find trouble writing their assignment due to a lack of writing skills. Such students need to worry no more since there are several available online assignment help websites. As such, this article provides the top 10 most trusted online assignment help websites that ensure that students get the best out of their assignment help services. We take your assignments with paramount importance as happy students are our primary goal. Our services are the most affordable, trustworth...