2. University AAA has 150 staff which consists of an academic and a non-academic category. Each staff is given an option to select either a PENSION ON 56 YEARS scheme or a PENSION ON 60 YEARS scheme. Display the details of each staff information and the total number of academic staff and non-academic staff that have selected a PENSION ON 56 YEARS scheme and a PENSION ON 60 YEARS scheme. You are required to get an output as shown in Figure B. Staffs' Information Name NOIC Age Category Scheme .. .. Report of selected Scheme Category Academic PENSION 56 : .... PENSION 60 : .... Report of selected Scheme Category Non-Academic PENSION 56 : .... PENSION 60 : ....
Help me solve my coding. I almost could run it.
I provided to you the question.
#include <iostream>
#include <string>
using namespace std;
struct staff
{
string name;
int ic;
int age;
int category;
int scheme;
};
int *p;
int *q;
int *r;
int *t;
int ac_56, ac_60, nonac_56, nonac_60;
int main ()
{
for(int i=0; i<2; i++)
{
cout << "name: ";
getline(cin, staff[i].name);
cout <<"ic: ";
cin >> staff[i].ic;
cin.ignore();
cout << "age: ";
cin >> staff[i].age;
cin.ignore();
cout << "category (1-academic @ 2-nonacademic): ";
cin >> staff[i].category;
cin.ignore();
cout << "scheme (1-56 @ 2-60): ";
cin.ignore();
if(staff[i].category = 1 && staff[i].scheme = 1)
{
p = ac_56;
p++;
}
else if (staff[i].category = 1 && staff[i].scheme = 2)
{
q = ac_60;
q++;
}
else if (staff[i].category = 2 && staff[i].scheme = 1)
{
r = nonac_56;
r++;
}
else if (staff[i].category = 2 && staff[i].scheme = 2)
{
t = nonac_60;
t++;
}
else
{
cout << "lol tol tol lah.";
}
}
for (int i=0; i<2; i++)
{
cout <<"name"<<"\t\t"<<"ic"<<"\t\t"<<"age"<<"\t\t"<<"category"<<"\t\t"<<"scheme"<<endl;
cout << staff[i].name<<"\t\t"<<staff[i].ic<<"\t\t"<<staff[i].age<<"\t\t"<<staff[i].category<<"\t\t"<<staff[i].scheme<<endl;
}
for (int i=0; i<2; i++)
{
cout << "\n\nreported selected scheme"<<endl;
cout << "\ncategory academic:"<<endl;
cout << "\tpension 56: " << *p << endl;
cout << "\tpension 60: " << *q <<endl;
cout << "\ncategory nonacademic:"<<endl;
cout << "\tpension 56: " << *r << endl;
cout << "\tpension 60: " << *t <<endl;
}
}
![2.
University AAA has 150 staff which consists of an academic and a non-academic
category. Each staff is given an option to select either a PENSION ON 56 YEARS
scheme or a PENSION ON 60 YEARS scheme. Display the details of each staff
information and the total number of academic staff and non-academic staff that have
selected a PENSION ON 56 YEARS scheme and a PENSION ON 60 YEARS scheme.
You are required to get an output as shown in Figure B.
Staffs' Information
Name
NOIC
Age
Category
Scheme
...
Report of selected Scheme
Category Academic
PENSION 56 :
PENSION 60 :
Report of selected Scheme
Category Non-Academic
PENSION 56 :
PENSION 60 :
Figure B](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff7b64411-68e2-4754-a705-75c994ee8512%2F468168e2-f655-4f0a-8e10-7b01dc8156e7%2Ftm8gnoc_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)