Programming Exercise

Programming Assignment 1

 

Code and test a program that declares a series of variables and constants then calculates and displays an employee's gross pay. The required variables or constants are as follows:

     Employee Number - a positive integer variable consisting of 6 numeric digits (initialized to 332158)

     Employee Name - an array of 40 characters (initialized to your name)

     Department Code - a character variable (initialized to C)

     Hours Worked - a number in the range of 0.0 to 50.0 (initialized to 32.5)

     Pay Rate - a constant with the value 6.25

Be sure to use meaningful identifiers and initialize as specified. After your declarations, code one or more cout statements to display the employee's gross pay in the following format:

     Gross pay for employee 332158 - John Milton - (department code C) is $203.125

To calculate the gross pay, your program must multiply the hours worked by the pay rate.

Turn in a printout of the source code. I will only ask to see the diskette if your program has errors.