UMBC CMSC104 CSEE

CMSC104

Problem Solving and Computer Programming

 

Project 3 -- Pay Raises

Due

Project 3 is worth 100 points and due at 11:59pm, Thursday, 26 Oct

Requirements

Create a file named jdoe2p3.c, using the editor of your choice.

A company is giving raises to all of its salaried employees. Someone who earns less than $2000 per month receives a raise of $150 a month, and an employee with a monthly salary between $2000 and $5000 earns an additional $250 per month. We want to write a program to read a person's current monthly salary and to print the new salary.

You are to use functions to implement the following structure chart.

Each subtask will be implemented as a function. The function instructions() prints the opening instructions to the user. readSalary() prompts the user for a salary and returns the information. outOfRange() return TRUE (1) if the salary is negative or greater than $5000. Then newSalary() return the new salary based on the current salary.

You will name your functions as shown on the chart The four major subtasks are to show the user the instructions on how to use the program, get the user's input from the keyboard, check to see if it is out of range and final compute the new salary. This program will allow the user to any any number of salaries. The user will be prompted for more information, until the user enters a -1 as a sentinel value. You must do error checking on all inputs. When printing out all salarys,

Compiling

Compile the program with the following command: If you get an error or warning, and you probably did, simply go back into the editor and fix it. Then recompile, continuing until you get no warnings or errors.

Executing

Execute the program with the following command: ./a.out If everything worked correctly, you should get the messages giving the distances.

One Sample Output

(User input is in green.)
This program interactively reads a monthly salary
and comutes a new montly salara.l  If the salary
is less than $2000.00 a month, the rasie is $150.00 a month.
If the salarya is between $2000.00 and $5000.00 a month, 
the raise is $250 a month.Enter 0.0 to exit the program.

Type a montly salary between $0.01 and $5000.00
Do not use the dollar sign or commas.  Enter 0.0 to exit the program. 4000.00

 The new salary is $4250.00 
Type a montly salary between $0.01 and $5000.00
Do not use the dollar sign or commas.  Enter 0.0 to exit the program. 1500.00

 The new salary is $1650.00 
Type a montly salary between $0.01 and $5000.00
Do not use the dollar sign or commas.  Enter 0.0 to exit the program. 2000.00

 The new salary is $
 2250.00 
Type a montly salary between $0.01 and $5000.00
Do not use the dollar sign or commas.  Enter 0.0 to exit the program. 0.0
  

Notice that the UNIX prompt must be on the next line!

Turning In Your Project

Once you have everything absolutely correct, you must use Blackboard to submit the project to the TA for grading. Do not email it to the instructor because you will lose points for not following instructions!

When submitting the assignment, I only want the file jdoe2p4.c. Please make the title and the file name the same when you submit it! If you submit a file named jdoe2p4.c, the way we save the material delete everything but the last file with than name. Therefore, your file will be lost and we will give you a zero!!!! Use your login ID!!!

Grading

This project will be grade using the following scale:

Documentation 25 points
Correct Results25 points
Correct Sytle25 points
Other25 points

You will lose 5 points if you do not name the file correctly.
You will lose 5 points if you email the project instead of submitting it via Blackboard.
You will lose 5 points if the prompt is not on the next line.

Comments Required

        /*****************************************************/
        /* Program Header Block                              */
        /* Filename:       jdoe2p4.c                         */
        /* Name:           Ima Student                       */
        /* Email:          jdoe2@umbc.edu                    */
        /* Date:           11 May 2006                       */
        /* Course/section: CMSC-104                          */
        /* Description:                                      */
        /*     Analysis:                                     */
        /*         Input:                                    */
        /*         Output:                                   */
        /*         Constraints:                              */
        /*         Formulas:                                 */
        /*         Assumptions:                              */
        /*     Design:                                       */
        /*         (Your psuedocode goes here.)              */
        /*                                                   */
        /* Notes:          (As needed.)                      */
        /*****************************************************/
        

Function Header Comment Block (One for each function)

/*********************************************************** 
 * Function name:    function_name                         *
 * Description:      (Your function psuedocode goes here)  *
 * Input Parameters: Name and data type of each parameter. *
 * Return Value:     Data type and description of what     *
 *                   the return value is.                  * 
 ***********************************************************/
  


UMBC | CSEE