Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that will calculate the gross pay of a set of employees. Use this template! https://ideone.com/cYSZCX The program should prompt the user

Write a C program that will calculate the gross pay of a set of employees. Use this template! https://ideone.com/cYSZCX

The program should prompt the user to enter the number of hours each employee worked, their name, clock number, and hourly wage. The progam should determine overtime hours (anything over 40 hours) and gross pay then outputs a table in the following format:

Name Clock# Wage Hours OT Gross

Add a Total row at the end to sum up the hours, overtime, and gross columns. Add an Average row to print out the average of the hours, overtime, and gross columns. Calculate and print the minimum wage, hours, overtime, and gross values. Calculate and print the maximum wage hours, overtime, and gross values. It should be on the same table in the following format:

Total: Average: Minimum: Maximum:

Column alignment, leading zeros in Clock#, and zero suppression in float fields is important. Use 1.5 as the overtime pay factor.

You should implement this program using the following structure to store the information for each employee:

struct employee { char first_name [10]; char last_name [10]; int id_number; /* use can use long int if you wish */ float wage; float hours; float overtime; float gross; struct employee *next; };

Create a linked list of structures using the following data: Name, Clock #, Hourly Wage

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

Get the data above from the terminal, and for each one: get dynamic memory, using malloc, for an employee node, put the employee data in the dynamic memory node, and link the nodes with pointers in the above order.

After the list pointers are in place you must get at the second and later instances of the structure by going from the first structure down the chain of list pointers. Then, for each employee, read in the hours worked from the terminal. Do all appropriate computations, and write out the table. You do not need an array of structures.

Use one or two scanf statements to read in the first and last names with the %s format. Use left justification to line up character array name values ... for example: %-10.10s or %-10s.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions