For each employee the program should prompt the user to enter the clock number,
ID: 440671 • Letter: F
Question
For each employee the program should prompt the user to enter the clock number, wage rate, and number of hours. The clock number is a unique identifier for an employee, the wage rate is the hourly rate the employee is paid, and hours is how many hours an employee worked within a given week. The program determines the gross pay and outputs the following format: ----------------------------------- Clock# Wage Hours Gross ----------------------------------- 098401 10.60 51.0 540.60 Column alignment, leading zeros in Clock#, and zero suppression in float fields are important. Remember that you cannot type in 098401 (its Octal, and invalid as well) ... type in as 98401 and use print formatting to print as 098401. Assume that clock numbers are at a most 6 digits long, and pad with leading zeros if less than 6 digits. Use the following data as test input: Clock# Wage Hours 98401 10.60 51.0 526488 9.75 42.5 765349 10.50 37.0 34645 12.25 45.0 127615 8.35 0.0 Do not use any material from any chapters beyond this week's lecture notes. I realize those more experienced could use an array, structures, pointers, and other concepts, but weExplanation / Answer
#include main() { int employees=0; long clock=0; float wagerate=0,hours=0,grosspay=0; printf("enter the number of employees "); scanf("%d",&employees); printf("no of employee details to be displayed is %d",employees); for(int i=0;i6 )||((clock/100000)==0) || ((clock/10000)==0) || ((clock/1000)==0)|| ((clock/100)==0)|| ((clock/10)==0)|| (clock==0) ){ printf("enter max of 6 digit or less clock number which does not start with zero "); scanf("%d",&clock); } printf(" enter the wage rate "); scanf("%f",&wagerate); printf(" enter the no of hours"); scanf("%f",&hours); grosspay=wagerate*hours; printf("employee details "); PrintClock(clock); printf(" wagerate=%f hours=%f grosspay=%f",wagerate,hours,grosspay); } } int CountDidgets(long val) { int d = 1, c; if (val >= 0) for (c = 10; c = val; c *= 10) d++; return (c < 0) ? ++d : d; } void PrintClock(long val){ int i; i=CountDidgets(val) ; while(iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.