Write a C program that runs on ocelot for a salary calculator using only the command line options. You must use getopt to parse the command line.
The calculator will only do bonuses and raises to a base salary as well as a veterans bump.
Usage: salary [-b bnum] [-r rnum] [-v] base
- The variable base is the starting salary where the base should be validated to be an integer between 50000 and 100000 inclusive. It would represent a salary. Error message and usage shown if not valid.
- For the -b option bnum should be a positive integer between 1 and 10 inclusive. It would represent the multiplier for a bonus on top of the salary. Error message and usage shown if not valid.
- For the -r option rnum should be a positive integer between 5 and 10 inclusive. It would represent a percentage raise based on the salary. Error message and usage shown if not valid.
- -b adds (bnum times 1000) to the base.
- -r multiplies the base by the percentage given and adds it to the base.
- -v adds an 8000 bump to the base.
- Output should have exactly 2 decimal places no matter what the starting values are as we are talking about money.
- If -v is included, it is executed first. If -r is included it would be executed next. The -b would be executed last.
- There will be at most one of each option, if there are more than one you can use either of the options in the calculation.
Create a simple Makefile to compile your program into an executable called salary.
Test your program with the following command lines and take a screenshot after running the three lines. The command prompt should be viewable.
- salary -b 2 -r 5 90000
- result: 96500.00
- salary -v -r 7 50000
- result: 62060.00
- salary 40000
- result: 40000.00
Do you similar assignment and would want someone to complete it for you? Click on the ORDER NOW option to get instant services at essayloop.com
Do you have a similar assignment and would want someone to complete it for you? Click on the ORDER NOW option to get instant services at essayloop.com. We assure you of a well written and plagiarism free papers delivered within your specified deadline.