This needs to be simple code that only uses looping (no structures, or any other
ID: 440711 • Letter: T
Question
This needs to be simple code that only uses looping (no structures, or any other advanced set up) The Program Determines Gross Pay and Outputs The Following Format: Clock # Wage Hours Gross 98401 10.60 51.0 540.60 Use The Following Data As Test Input Clock # Wage Hours 98401 10.60 51.0 562488 9.75 42.5 765349 10.50 37.0 34645 12.25 45.0 127615 8.35 0.0 The program should query the user for how many sets of test data (i.e. employees to process) and loop that many times. In our example above, you would enter the number 5, as there would be 5 employees to process. Don't expect a nice output that shows all of the employee data in one table. Its OK To have your output show the prompts for data on the first employee, print information about that employee, prompt for information about the next employee, print info on that next employee, and so one until each employee data set is processed. You will run this program ONE time as stated before, and you will initially prompt the user for the number of data sets to process (such as 5) that you will incorporate into your loop test.Explanation / Answer
GrosslyPaid[5]; /* gross pay array */ unsigned int NumberOfEntries = 5; /* number of entries */ float OvertimeHours[5]; /* overtime hrs array */ /* wage rates array */ float WageRate[5] = { 10.60, 9.75, 10.50, 12.25, 8.35 }; /* Prompt for input values from the screen */ /* calculate overtime hours and gross pay */ for ( EntryNumber = 0; EntryNumber < NumberOfEntries; EntryNumber++ ) { ClockedHours[EntryNumber] = GetClockedHours ( ClockNumber[EntryNumber] ); OvertimeHours[EntryNumber] = CalcOvertimeHours ( ClockedHours[EntryNumber] ); GrosslyPaid[EntryNumber] = CalcGrossPay ( ClockedHours[EntryNumber], OvertimeHours[EntryNumber], WageRate[EntryNumber] );
printf (" ---------------------------------------------------------- ");
printf (" ---------------------------------------------------------- "); printf (" %06i %5.2f %5.1f %7.2f ",clock[i],wage[i],hours[i],gross[i]); printf("This employee worked %f hours with a per-hour basis of %f. ", hours[i], wage[i]);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.