Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Please help me to solve this problem. (http://www.go4expert.com/forums/help-solve-t18726/)

sujan.dasmahapatra 28Jul2009 11:52

Please help me to solve this problem.
The MISER CORPORATION must meet its payroll within one week. They wish to save on pencils, paper and accountants. They have, therefore, decided to do all the calculations by computer. Having heard of your programming experience and your willingness to work for pennies, the company has hired you to write a complete C++ program, including comments to do the following:
1. Print the following heading at the top of the output page:
Miser Corporation Payroll
2. Read an unknown number of employee data records as shown below. Each group of data will contain an employee's first and last name, hours worked, rate of pay and age. A typical group of data will be:
Duck Donald
45.0 3.25 51
Print the data as it is read; together with appropriate messages (e.g., the name is ..., the rate of pay is ..., etc.).
3. For each employee, compute and print the employee's base pay, which includes overtime (paid at one and a half times the normal rate) for each hour over 40. For example, if an employee earning $20.00 per hour works for 48 hours, then she will be paid for 40 hours at her normal rate plus 8 extra hours at $30.00 (one and a half times $20.00).
4. For each employee compute the tax paid by the employee, according to this formula: If the employee is 55 years old (or older), then the employee pays tax at a rate of 50% of the base pay; if the employee is below 55, then the tax is 10% of the base pay. Print the tax and the net pay after taxes.
5. Repeat this process until you have read the last employee. You must decide how to detect the end of the data (you should explain your method in a comment).
6. Print the age and name of the oldest employee. Do the same for the youngest employee.
7. After all your results have been printed, print a message saying that the payroll program is complete.
The data below is to be placed in a data file misercorp.dat. Make up 6 additional sets of data. Be sure to cover all possible cases. Make sure that your answers are correct before you hand in the program. All programs are to be commented, neatly indented, and in proper style. You are to hand in your source code, the printed results and a copy of your data file.
Duck Donald
45.0 3.50 60
Mouse Mickey
35 3.50 55
Brown Charlie
35 3.50 20
Oyle Olive
40 3.50 60
Man He
45 3.50 20
Ra She
40 3.50 20
Jetson George
45 3.50 55
Starr Brenda
35 3.50 60
Woman Wonder
40 3.50 55
Make up 6 more sets of data.
** ** * ** * * * ** ** * * * *
Can anyone explain me how to calculate the 3rd and 4th point,i.e employee's base pay and tax...Please read the 3 and 4 points above.
Duck Donald
45.0 3.50 60
Please tell me whats the base pay for Duck and his tax....????

xpi0t0s 28Jul2009 12:43

Re: Please help me to solve this problem.
Doesn't seem too hard...

First work out what the numbers mean.

Which is hours worked, which is the rate and which is the age?

Base pay: Does Donald work more or less than 40 hours?
If more, what does he get paid for the 40 hours, and what does he get
paid for the extra time?

Tax: is Donald older or younger than 55?
If he's older, what would the rate be?
How would you calculate the tax from the amount paid and the rate?

mayjune 28Jul2009 17:27

Re: Please help me to solve this problem.
What does it mean, rate of pay?
Lets say Duck Donald has 3.25 rate of pay, what does it mean??

xpi0t0s 28Jul2009 20:40

Re: Please help me to solve this problem.
Units of cash per hour. So if Donald works 10 hours he gets paid 10x that, which is 32.50.

All times are GMT +5.5. The time now is 23:01.