I need someone to write alogrithms for the following two blocks of code... 1st block: void HRM::UpdatePerson(){ int empI

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

I need someone to write alogrithms for the following two blocks of code... 1st block: void HRM::UpdatePerson(){ int empI

Post by answerhappygod »

I need someone to write alogrithms for the following two blocksof code...
1st block:
void HRM::UpdatePerson(){
int empId; char redo1,redo2;
lebel: cout << "ID of employee you are modifying: ";
while(!(cin>>empId)) //Reciving vaiables frominput : is it no/character ? { cout << "Please enter a number! Tryagain: "; cin.clear (); cin.ignore (1000, '\n'); // Skip to nextnewline or 1000 chars, // whichever comes first. }
int flag1=0; for (int i = 0; i < n; ++i) {
if (y!=empId) { flag1++;
} } /* if (flag1==n){
// cout<<" not matching="<< y;cout<<"Sorry, there is not any employee with requestedpersonal number. Do you want to repeat delete by entering the newpersonal number (y/n)?:"; cin>>redo1; if(redo1=='Y'||redo1=='y'){ goto lebel; } } */
cout <<endl;lebel1:
for (int i = 0; i < n; ++i) {
if (y==empId) {
cout<<"matching="<< y;
flag=true; int choice = 0; char redo;
do { cout << endl << endl; cout << "Please enter the numberrelated to the change you are trying to make: " <<endl; cout <<"1. First name" <<endl; cout << "2. Family name" <<endl; cout << "3. Working hours perweek" << endl; cout << "4. Payment for one hour"<< endl; cout << std::endl;
cin >> choice; if (choice == 1) { cout << " First name:"; e.in_FirstName(); } else if (choice == 2) { cout << " Family name:"; e.in_FamilyName(); } else if (choice == 3) { cout << " Working hoursper week: "; e.in_Workinghour(); } else if (choice == 4) { cout << " Payment for onehour: "; e.in_Costperhour(); } cout<<"Do you want to updateanother field (Y/N)="; cin>>redo; } while (redo=='y'||redo=='Y'); } } int a; a=n; cout<<"\nThe employee with the following informationhas been added to the system:"<<endl; cout<<"\nFirst Name Last Name Personal ID Salaryper year (USD)"; cout<<"\n-------------- -------------- ------------ -------------------------"<<endl; for(int i=0; i<a; i++){ e.get_FieldName();
cout<<"hahahahah="<<n<<endl;
}}
2nd Block:
int main(){ //-------defining variables and initializingthem-------------
HRM info ;
int c; char operation,ch; //--------Printing my name on screen---------------- cout<< "Welcome to XYZ HRSystem Management by Kaiser, James."<<endl; cout<<"**************************************************************************"<<endl; cout<<endl<<endl<<endl; do {
cout<<"Welcome to Human Resource Management(HRM) Software of Company XYZ."; cout<<"To do specific task please choose one ofthe following commands."<<endl<<endl<<endl; cout<<" 1. Add newemployee"<<endl; cout<<" 2. Delete employeeinformation"<<endl; cout<<" 3. Update employeeinformation"<<endl; cout<<" 4. Make reports based onspecific field"<<endl; cout<<" 5. Searchemployee"<<endl; cout<<" 6.Quit"<<endl<<endl;
while(!(cin>>c)) //Reciving vaiables frominput : is it no/character ? { cout << "Please enter a number! Try again: "; cin.clear (); cin.ignore (1000, '\n'); // Skip to nextnewline or 1000 chars, // whichever comes first. } switch(c) { case 1: cout<<"\nEnter the information of thenew employee"<<endl; info.AddPerson(); break; case 2: info.DeletePerson(); break; case 3: cout<<"\nEnter an item todeletion"; info.UpdatePerson(); break; case 4: cout<<"\nEnter an element tosearch"; info.ReportList(); break; case 5: info.SearchPerson(); break; default : cout<<"\nInvalid option try again";
} cout<<"\nDo you want to continue"; cin>>ch; } while(ch=='y'||ch=='Y');
system("pause"); return 0;}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply