QuestionQuestion

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


Report File Specifications

Your output should appear identical to that shown below (same horizontal spacing and everything).

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.

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

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define EMP_SIZE 100
#define DEPT_NAME_LEN 20
#define EMP_NAME_LEN 10
#define PERIOD_HOUR 40

/**
* struct employee
*/
struct employee{
    char fName[EMP_NAME_LEN];
    char lName[EMP_NAME_LEN];
    double hourlyWage;
    double hours;
};

typedef struct employee employee;

/**
* struct department
*/
struct department{
    char name[DEPT_NAME_LEN];
    employee * emp[EMP_SIZE];
    int num;
};...
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats