ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 27 Apr 2017 My Price 9.00

owner of a medium-sized growing company

Assignment Specifications

Overview

You are the owner of a medium-sized growing company consisting of more than 100 employees. The company has several departments, each of which might have up to 50 employees (but possibly more). You are developing a Weekly Department Salary Report program. The user will interactively enter information for each employee, including their first name and last name, hourly wage, and number of hours worked. The program should create a report as this information is entered. The report will be stored in a disk file.

The report will include the information entered by the user, plus will show both the regular and overtime hourly wage, regular and overtime pay for the period, and a total pay for the period. The overtime rate is 1.5 times the regular rate, although the legislature is considering changing this within the next year or two. Overtime is currently paid for any time over 40 hours during the period; however, this might change too.

User Interface Specifications

Here is a sample dialog. Your spacing and wording should be the same as it is here. Please note that the yes/no answer in response to "Process another employee?" is a single character, and can be Y, y, N or n. No validation is necessary in this program, so assume that the user types a valid response (one of the ones just mentioned).

Mountain Pacific Corporation
Department Salary Program

Please enter the name of the department: Marketing

Enter employee #1: Juan Arago
Enter the hourly wage of Juan Arago: 12.50
Enter total number of hours: 40

Thank you. Process another employee? Y

Enter employee #2: Winnie Chen
Enter the hourly wage of Winnie Chen: 11.45
Enter total number of hours: 45.5

Thank you. Process another employee? y

Enter employee #3: Jack Donovan
Enter the hourly wage of Jack Donovan: 16.80
Enter total number of hours: 60

Thank you. Process another employee? Y

Enter employee #4: Francine Jackson
Enter the hourly wage of Francine Jackson: 19.00
Enter total number of hours: 35

Thank you. Process another employee? n

End of processing.



Report File Specifications

Please follow these rules for full credit!

Your output should appear identical to that shown below (same horizontal spacing and everything). If lines are missing or values are off or spacing is different, your score will take a hit.

Assume that the department name is only one word, 20 characters long maximum, with no embedded spaces. Assume each name requested interactively is actually a first name and a last name, so TWO variables will be involved. Each of the two names is limited to a logical length of 10 characters, which means that the maximum logical length of the entire name will be 21 characters (which includes the space between the names). Be very careful of your string lengths! Remember the guidelines discussed in the lecture.

You'll have to do a little thinking to figure out how to get the printed names lined up with all the other columns. The first hint is that it involves joining strings together, something called concatenation. Give it a go, and if you can't figure it out, look at the next document in this folder; it contains additional hints. Part of the purpose of this assignment is to implicitly teach you concatenation. Do NOT use tabs (t) and make sure your C/C++ editor does not produce tab characters.

Do NOT use gets() in this program. Use scanf() for inputting the interactive information. If you try to use gets(), you may get VERY frustrated.

In essence, all numbers appearing in the report should be right-justified and decimal-aligned. All numbers appearing in the summary should appear without leading spaces (other than the one which normally separates the number from the previous word). Hourly wage amounts CAN be less than 10.00, so be very careful with your formatting. The sample output can appear correct, but you can still be docked a half-point if things don't align properly with hourly wages under $10.00.

Your calculated amounts in the report should NOT be off by one cent. Since we are all using Dev C++, you should end up with the exact same results as below.

Here is the report that would be developed from the sample input above. The output should be written to the file similar to your previous assignments (c:class folder and with the filename having your first initial and last name with a -pay at the end). 

Your output file should START with the Mountain Pacific line; there is no blank line before it.

Mountain Pacific Corporation
Department Salary Program

Department: Marketing

Employee                Reg Hrs        Overtime Hrs       Gross
-----------------------------------------------------------------
Juan Arago            40.0 ($12.50)    0.0 ($18.75)    $ 500.00
Winnie Chen           40.0 ($11.45)    5.5 ($17.17)    $ 552.46
Jack Donovan          40.0 ($16.80)   20.0 ($25.20)    $1176.00
Francine Jackson      35.0 ($19.00)    0.0 ($28.50)    $ 665.00
-----------------------------------------------------------------

Total Regular Hours Worked: 155.0
Total Overtime Hours Worked: 25.5
Percentage of Total Hours That Are Overtime: 14.1%

Total Regular Wages: $2295.00
Total Overtime Wages: $598.46

Total Wages This Period: $2893.46

Clarifications

You may assume that the employee name is always two names, a first name and a last name separated by a space. Also assume that there are never any spaces within a first name or within a last name. This allows you to use two scanf() calls instead of one gets() call. gets() would introduce some oddities that make things not work correctly later down the line. 

You may also assume that neither name exceeds 10 characters in length. 

The input from the Process another employee? question should be a single character. Assume that N or n will stop the loop, but that any other character will continue the loop.

You may assume that the overtime wage rate never exceeds 99.99, and therefore the highest regular hourly wage is 66.66. No need to test for this or do anything special. I seriously doubt that an hourly non-exempt employee will be pulling down over $138,000 a year at Mountain Pacific! :-)

Important Hints 

Hint #1

You will need to approach the interactive reading of the name in the loop as two names--the first and the last. You should still do this with one prompt though. When printing in the report, approach it as one name so that things are properly justified. 


Hint #2

You will need to concatenate the first name together with a space and the last name. To do this, you must use two functions found in the string.h library (remember to "include" it): strcpy() and strcat(). Both are voided functions and can be used as statements. 

strcpy() accepts two arguments. The first is the "result" string variable, and the second is a string value to be assigned to the "result" variable. strcat is similar, except it expects that the string variable in the first argument already has a value, and it will append (or "concatenate" the 2nd argument onto the end of the first's value. Note the following sequence as an example:

strcpy(title, "Smoke Rings"); // This assigns "Smoke Rings" to title.
strcat(title, " in the");     // This concatenates " in the" to the end of title.
strcat(title, " Dark by ");   // This concatenates " Dark by " to the end of title.
strcat(title, artist);        // This concatenates the char string value that is
                              // inside of artist to the end of title.


Assume here that the variable artist already has a value in it, and it is a string representing the artist's name. After these statements, title will have the value "Smoke Rings in the Dark by Gary Allan" (assuming that artist was previously given the value "Gary Allan" via assignment or input). 

Be careful. C doesn't check to see if the first argument's length is long enough to handle the resultant string. You could end up with a General Protection Fault if you go over. 


Hint #3

In formatting columnar reports, your width specifier is very important. You won't generally use 0 as a width specifier in such a report. Make the columns as wide as the specs say. A positive number right-justifies the value; a negative number left-justifies the value. Strings are typically left-justified. Remember, if it is a numeric format (such as 6.2), the 6 represents the entire width of the value on the screen/on paper (including the decimal point and the decimal digits), and the 2 represents the number of decimal digits.


Hint #4

It's possible that an employee can make $9.99 per hour or less. Because of this, pay close attention to hint #3 above. We may test your program with some small hourly wages to make sure everything still lines up!

Answers

(11)
Status NEW Posted 27 Apr 2017 04:04 AM My Price 9.00

-----------

Not Rated(0)