Question: Write the code in C++. kindly use the given details Q6: Consider the following structure definitions: struct Employee struct Address char city [20]; int postcode;
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; i 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 (58 of gross salary for scale 1 to 10 employees and 7.58 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 First employee Reference to the next Employee Nullend 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
Get step-by-step solutions from verified subject matter experts
