Description
This week’s assignment will have you write a program that introduces you to floating-point number
output, constants, boolean expressions and conditional flow. Feel free to work in pairs and ask for help
early.
Using the Terminal command line, create a folder (using the mkdir command) called lab02 and cd
into that folder. I have added an example of what should happen when the program is run to the end of
this document. Your source code file must have a preamble at the top (see the programming rules and
guidelines document in Blackboard for more on the preamble).
Problem: Workers at a particular company were awarded a pay increase, retroactive for six months.
The amount of the increase for each employee depends on the their prior annual salary. For those
making 25000.00 or less, the increase is 8.2%. For those making more than 25000.00, but less than
30000.00, the increase for the retroactive period is 5.4% and the increase for future salary is 4.9%. If
the prior salary is 30000.00 or more, up to 40000.00, the increase is 3.3%. Above 40000.00, there is
no increase.
Write a program (lab02.cpp) that takes an employee’s previous annual salary as input and outputs the
amount of retroactive pay due the employee, the new annual salary, and the new monthly salary.
Use four global constant variable declarations to hold the four different rate increase values which you
must use in your code. Output for monetary values should include two decimal places (see the magic
formula from the book).
Submitting your work
Make sure you are in your lab02 folder (use the pwd command) with your source code file (use the ls
command) and then run the following to create a zip archive of them:
$ mkdir lastname_firstname_lab02
$ cp lab02.cpp lastname_firstname_lab02/lab02.cpp
$ zip –r lastname_firstname_lab02.zip lastname_firstname_lab02/
You’ll need to change lastname and firstname to your actual last and first names in the steps
above. Once you have your zipfile, you can use that file as your submission for the assignment in
Blackboard.
If you are working in pairs, then you should have both of your names included as comments in the
source code file’s preamble (see the programming rules and guidelines document in Blackboard for
more on the preamble). Also, write both your names to the notes section in the submission form when
submitting to Blackboard.
CSCI 136 Supervised Programming Lab
Lab Assignment #2
Fall 2014 Page 2
Sample output
$ ./lab02
Enter your current annual salary (e.g. 50000.00): 24000.00
Your retroactive pay is $984.00
Your annual salary is now $25968.00
Your monthly salary is now $2164.00
$ ./lab02
Enter your current annual salary (e.g. 50000.00): 28000.00
Your retroactive pay is $756.00
Your annual salary is now $29372.00
Your monthly salary is now $2447.67
$ ./lab02
Enter your current annual salary (e.g. 50000.00): 35000.00
Your retroactive pay is $577.50
Your annual salary is now $36155.00
Your monthly salary is now $3012.92
$ ./lab02
Enter your current annual salary (e.g. 50000.00): 45000.00
Your retroactive pay is $0.00
Your annual salary is now $45000.00
Your monthly salary is now $3750.00