Homework #06 (Due: Fri 30 Jan)
For this assignment you will write a simple ``payroll'' program in
which the user enters an hourly pay rate and the number of hours
worked. You will calculate the wages owed to the employee according to
the following chart:
|for up to the first 40 hours
|for hours over 40 and up to 60
||time and a half
|for hours over 60
For example, if a worker's pay rate is $8.50 per hour and they
have worked a total of 45 hours during the week, their pay is
calculated to be:
Here are some suggestions that I believe will save you quite a bit
of time (if you follow them):
- Before you attempt to create a general solution to this problem,
make sure you are able to solve the problem by hand. Select several
scenarios and verify that you are able to obtain a correct answer.
- Before you begin typing your program, I would encourage you to
create an algorithm to solve the problem. If this kind of
problem-solving is new to you then you should probably commit
your algorithm to paper. Once you have firmly grasped the steps
necessary to solve the problem, then you can be typing
- Use an existing program as your starting point.
- Don't type in your entire program first and then try to compile.
Rather, begin by doing a small piece (such as getting values
for pay rate and hours worked from the user). After you have
completed a simple, small portion of the program then save your
work and attempt to compile the program. Once that small
section is completely working, work on the next small section
(performing the calculations). Continue this process until
the program is finished.
Submit your program by email as usual.