Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING C++ PROGRAM A company has employees that receive different salaries. To donate to a social cause, the CEO of the company deducts a percentage

USING C++ PROGRAM

A company has employees that receive different salaries. To donate to a social cause, the CEO of the company deducts a percentage of each employees salary during the month of December.

The following table shows the salary ranges and the percent deductions for year 2017. The first column identifies a salary range.

ID

Salary

Percent Deduction

1

100-1000

0.50%

2

1001-5000

1.50%

3

5001-10000

2.50%

4

10001-15000

3.50%

5

15001-20000

4.50%

In the first part of your program, do the following.

Declare variables ID, SALARY, DEDUCTION and NET in your program.

Prompt the user for an ID.

If the ID is not zero, prompt for the employees Salary. For example, if ID is 2, prompt for a salary in the range 1001-5000. If the ID is out of range, print an appropriate error message and read the ID again.

Use appropriate decision statements to validate the salary entered by the user.

If the salary is valid, calculate the net salary by deducting percent deduction from the salary.

If the entered salary is out of range, print an appropriate error message and read the salary again.

Make sure your program can handle all 5 salary ranges and all inputs.

As output, print the BASE Salary (salary entered by the user), the DEDUCTION, and the NET Salary.

Make sure your program can handle all unexpected inputs by printing appropriate messages and reading and processing the input until a 0 is entered as the ID.

In the second part of your program, create the 2-D integer array LOG[10][3]. As user input is read and net salary is computed, SALARY, DEDUCTION, and NET should be saved in LOG[*][0], LOG[*][1], and LOG[*][2], respectively. The first index in the array shows the order in which employee information is entered. Therefore, LOG[k][*] shows the kth employee entered by the user, k starting from 0. Your program should check for the number of employees processed and if 10 (k==9) employees are already processed, it should print the content of the table as a report and leave the program.

An example user interaction with the program is shown below. User input is shown in bold.

Enter ID: 3

Enter SALARY (5001 10000): 2000

Salary is out of range.

Enter SALARY (5001 10000): 6000

Base Salary: $6000, Deducted Amount: $150, Net Salary: $5850.

Enter ID: 4

Enter SALARY (10001 - 15000): 12000

Base Salary: $12000, Deducted Amount: $420, Net Salary: $11580

Enter ID: 0

Employee Donations in year 2017:

NO SALARY DEDUCTION NET SALARY

1 $6000 $150 $5850

2 $12000 $420 $11580

End of Report

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

What is job rotation ?

Answered: 1 week ago