ECE 231 – Fall 2009
Programming Assignment 1
Due: Friday, August 28, 2009 at 11:59 PM
You need to develop a program that calculates an employees pay. The program should ask the user to enter both the number of hours worked during the week and the hourly pay rate. You will need two variables for these values (you could use an int for the number of hours and a double for the pay rate.)
Next, the employee will be responsible for both federal and state taxes. The federal tax rate is 0% is the employee makes less than $60, 10% between $60 and $615 (inclusive), and 15% if over $615. If an employee makes more than $60 (inclusive), then they must pay the 5% state tax. Remember that for each employee, they will have one value for their federal tax rate (or federal taxes) and one value for their state tax rate (or state taxes.)
Using these tax rates, calculate the net pay of the employee and print the value. You also need to print the gross pay of the employee (amount before taxes.)
The calculated pay needs to be printed with the precision set to two and you need to make sure that the user does not enter in any invalid numbers as input.
For extra credit (10 points), if the employee works more than 40 hours per week, calculate the pay using overtime at time and one half for any hours over 40 per week. Make sure that you indicate in your program that your program calculates this value so that the results can be verified!
You will need to enter in multiple values for the number of hours and the pay rate to verify that all the different values of employees’ net pay and gross pay are calculated correctly.
Email your final assignment to speralta@unm.edu (be sure to include your name and follow the proper naming convention as described in class.)