Homework 6 Character Strings

Oct 15th, 2014
Sigchi4life
Category:
Engineering
Price: $5 USD

Question description

HOMEWORK 6
CHARACTER STRINGS

Write a C program that will calculate the gross pay of a set of employees.

The program should prompt the user to enter the number of hours each employee worked. When prompted, key in the hours shown below.

The program determines the overtime hours (anything over 40 hours), the gross pay and then outputs a table in the following format.

Column alignment, leading zeros in Clock#, and zero suppression in float fields is important.

Use 1.5 as the overtime pay factor.

    ---------------------------------------------------------
    Name            Clock#   Wage   Hours     OT     Gross
    ---------------------------------------------------------
    Connie Cobol    098401   10.60   51.0    11.0    598.90
    Mary Apl        526488    9.75   42.5     2.5    426.56
    Frank Fortran   765349   10.50   37.0     0.0    388.50
    Jeff Ada        034645   12.25   45.0     5.0    581.88
    Anton Pascal    127615   10.00   40.0     0.0    400.00
    ---------------------------------------------------------

    Total:                          215.5    18.5    2395.84
    Average:                         43.1     3.7    479.168
    Minimum                          37.0     0.0    388.50
    Maximum                          51.0    11.0    598.90

Additionally, here are a few more things I would like you to calculate and print out.

1) These are mandatory and need to be done:

  a) Add a Total row at the end to sum up the hours, ot, and gross columns
  b) Add an Average row to print out the average of the hours, ot, and gross columns

2) These two optional challenges if you have time

  a) Calculate and print the minimum hours, ot, and gross values
  b) Calculate and print the maximum hours, ot, and gross values


You should implement this program using a structure similar to the suggested one below to store the information for each employee.  Feel free to tweak it if you wish.  For example, its OK to have a first and last name member instead of just a name member, and if you want to use different types, that is OK as well.

    struct employee
    {
      char  name [20];
      long  id_number;
      float wage;
      float hours;
      float overtime;
      float gross;
    };

Use the following information to initialize your data.

    Connie Cobol     98401   10.60   
    Mary Apl        526488    9.75
    Frank Fortran   765349   10.50
    Jeff Ada         34645   12.25
    Anton Pascal    127615   10.00

Create an array of structures with 5 elements, each being of type struct employee. 

Initialize the array with the data provided and reference the elements of the array with the appropriate subscripts.

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Duke University
PREMIUM TUTOR

Studypool has helped 1,244,100 students

Summary
Quality
Communication
On Time
Value
darnay
Feb 15th, 2017
" The best tutor out there!!!! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1823 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors