You are going to write a program for your own small business. (The business type is your choice, but keep it legal.) There are three parts to the project. Do each part separately first, in its own program. Then, combine the parts as functions into one program.
Remember good coding practices: use of well-written comments, good variable and function names, constants, functions, etc. (See the web pages and your lecture notes for more information about good style.)
Example Runs:
Enter the employee's hourly wage: 10 Enter the number of hours the employee worked: 40 Gross Pay: $ 400.00.
Enter the employee's hourly wage: 10 Enter the number of hours the employee worked: 41 Gross Pay: $ 415.00.
Earning less than $60000/year: | 5.55% |
Earning more than or equal to $60000/year: | 5.95% |
The (simplified) Federal Tax bracket is calculated as follows:
Less than $15000/year: | 8% |
Less than $30000/year: | 15% |
Less than $90000/year: | 27% |
Otherwise: | 40% |
Extend the previous program (in another program) to calculate and print the amount of taxes to be withheld from the paychecks. Finally, print the employee's net pay.
Example Runs
Enter the employee's hourly wage: 10 Enter the number of hours the employee worked: 40 Gross Pay: $ 400.00. ------Taxes Withheld------ FICA: $ 24.80 State: $ 22.20 Fed: $ 60.00 -------------------------- Net Pay: $ 293.00.
Enter the employee's hourly wage: 10 Enter the number of hours the employee worked: 41 Gross Pay: $ 415.00. ------Taxes Withheld------ FICA: $ 25.73 State: $ 23.03 Fed: $ 62.25 -------------------------- Net Pay: $ 303.99.
Other requirements:
Write separate functions for calculating the FICA, DE state, and federal taxes, given the gross wages.
Calculate the appropriate federal tax bracket using a
switch
statement rather than a series of
if-else-if
statements.
main
.) Add a menu so that the user can choose to execute
one of the above options (calculating the gross or net pay). Allow
the user to exit the program cleanly (without doing "Control-C"). Use
a switch statement to implement the user menu. (Why implement using a
switch statement? Consider the program's extensibility.)
Test plan (20 points)
Good programmers write a test plan before writing their code. They use the test plan to verify that the program operates as expected and to meet a customer's requirements.
Write your test plan in a separate file. (You can write the test plan in a format other than a plain text file in Emacs, if you would like.) Your test plan should include the program's input and its expected output. (How do you know the expected output?) Write a test plan for each of your programs. Follow the test plan in your script (after you've executed the required test cases).
Submit the electronic copy via email to Gang before 6 p.m. on July 11 and the paper copy to Sara before class.
Sign up for a demo with either Sara or Gang on CPM during the week of July 11.