Question: WRITE CODE IN C++ . Q6: Consider the following structure definitions: struct Employee struct Address char city [20]; int postcode; char email_id[20]; char name [20];

WRITE CODE IN C++ .

WRITE CODE IN C++ . Q6: Consider the following structure definitions: struct

Q6: Consider the following structure definitions: struct Employee struct Address char city [20]; int postcode; char email_id[20]; char name [20]; int scale; Salary YearlySalary[3]; Tax YearlyTax [3]; Address addr; Employee* next; struct Tax struct Salary int Year; float gross salary; int Year; float tax due; float net salary; Write a C++ program that asks the user to enter data for 10 employees. The following information should be entered by the user: name, scale (1 to 17), gross salary for the last 3 years, and address. The program should calculate the yearly tax (5% of gross salary for scale 1 to 10 employees and 7.5$ for scale 11 to 17) and net_salary (gross_salary - tax_due). For an employee, the structure variable should be allocated dynamically on heap memory using new operator. A pointer emp_ptr (of employee type) should be used to point to the first employee (initially emp_ptr will be NULL). The second employee should be referred by the first employee (Employee* next structure member). This will result in a chain of records in the heap (linked with each other using next pointer) as shown below. emp_ptr THL First employee Reference to the next Employee Null = end of linked list Next, find the "average" net_salary for all the 10 employees. Also, display the name and address of the employee who has paid the highest tax (for any year).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!