Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HOMEWORK 4 FUNCTIONS Write a C program using multiple functions that will calculate the gross pay for a set of employees. See the last lecture

image text in transcribed
image text in transcribed
image text in transcribed
HOMEWORK 4 FUNCTIONS Write a C program using multiple functions that will calculate the gross pay for a set of employees. See the last lecture note this week for a template you can use if you feel you need something to start with. However, feel free to implement this assignment that way you see fit, the template is just there if you need it. There are multiple ways to effectively implement this assignment. The program determines the overtime hours (anything over 40 hours), the gross pay and then outputs a table in the following format shown below. Column alignment, leading zeros in Clock number, and zero suppression in float fields is important. Use 1.5 as the overtime pay factor. Clock# Wage Hours OT Gross 098401 10.60 51.0 526488 9.75 42.5 765349 10.50 37.0 034645 12.25 45.0 127615 8.35 0.0 11.0 598.90 2.5 426.56 0.0 388.50 5.0 581.88 0.0 0.00 You should implement this program using one array for clock number, one array for wage rate, etc. . Read in the hours worked for each employee. . Limit your use of global variables - Learn how to pass parameters! . You should have at least 3-4 functions designed and implemented in addition to the main function. . Try to limit how much code you have in your main function, call other functions to do the work that is needed. . Remember to use constants and all the other things we have covered up to this assignment. . Re-read the homework coding standards ... make sure that each local variable is commented in EACH function, and EACH function has a descriptive function comment header. Note that a function comment header is not needed for your main function. . Feel free to initialize the clock and wage values into your arrays with the test data above. . DO NOT pre-fill the hours, overtime, and gross pay arrays with test data values. It is OK however to initialize them to zero if you wish, but it is not needed since these values get overwritten via input prompts or calculations. I would recommend that your clock, wage, hours, overtime, and gross values be stored in individual arrays. As a challenge, you can have your program prompt the user to enter the number of hours each employee worked. When prompted, key in the hours shown below. Do define your array size up front in your variable declaration. Don't define the array size at run time with a variable. This strategy does not always work on every C compiler. Create a separate function whenever possible to break up your program. For instance, you might have a function for obtaining the hours from the user, another function for calculating overtime hours, another for calculating gross pay and another function for producing the output. At a minimum, you should have a main function and three or more other functions. Finally, as always, don't use concepts we have not yet covered. Optional Challenge For those of you more experienced programmers, continue with the challenges below that were offered in last week's assignment. The additional challenge this week would be encapsulating the logic into functions that can be called to do this work. Calculate and print the total sum of Wage, Hours, Overtime, and Gross values Calculate and print the average of the Wage, Hours, Overtime, and Gross Values Clock# Wage# Hours OT Gross 098401 10.60 51.0 526488 9.75 42.5 765349 10.50 37.0 034645 12.25 45.0 127615 8.35 0.0 11.0 2.5 0.0 5.0 0.0 598.90 426.56 388.50 581.88 0.00 Total 51.45 175.5 18.5 Average 10.29 35.1 3.7 1995.84 399.17

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

How does the organizational market differ from the consumer market?

Answered: 1 week ago

Question

=+a. Describe the flaws you discovered in this e-mail message.

Answered: 1 week ago

Question

2. Describe three common types of routine requests.

Answered: 1 week ago