
#include <stdio.h>
#include <math.h>
#define SIZE 200
#define SRCFILENAME "payroll.txt"
#define TGTFILENAME "paid.txt"
typedef struct employee{
char name[100];
char title;
double hours_worked;
double payrate;
double payment;
}Employee;
int main(){
int totalEmployees;
double
pay,ot,otRate,totalPay=0,avgTP=0,maxTP=0,minTP=0|(int)(pow(2,(sizeof(double)+1)*8));
FILE *fp=fopen(SRCFILENAME,"r");
Employee payroll[200];
for(totalEmployees=0;!feof(fp);totalEmployees++){
fscanf(fp,"%[^,],%c,%lf,%lf\n",payroll[totalEmployees].name,&payroll[totalEmployees].title,&payroll[totalEmployees].hours_worked,&payroll[totalEmployees].payrate);
pay=(payroll[totalEmployees].hours_worked<=80)?payroll[totalEmployees].hours_worked:80;
ot=(payroll[totalEmployees].hours_worked>80)?(payroll[totalEmployees].hours_worked-80):0;
otRate=(payroll[totalEmployees].title=='B')?1.5:1.8;
payroll[totalEmployees].payment=payroll[totalEmployees].payrate*pay+otRate*payroll[totalEmployees].payrate*ot;
totalPay+=payroll[totalEmployees].payment;
maxTP=(maxTP>payroll[totalEmployees].payment)?maxTP:payroll[totalEmployees].payment;
minTP=(minTP<payroll[totalEmployees].payment)?minTP:payroll[totalEmployees].payment;
}
avgTP=totalPay/totalEmployees;
fclose(fp);
fp=fopen(TGTFILENAME,"w");
fprintf(fp,"Total Payroll(sum of all employees' total
payment): %.2lf\nAverage Total Payment: %.2lf\nMax total payment:
%.2lf\nMin total payment:
%.2lf\n",totalPay,avgTP,maxTP,minTP);
fclose(fp);
}
I need help with this C++ code for my programming class. Thank You! You own EasyButCostly Parking Garage. Write a program to calculate the parking fees based on the number of hours a car is parked in your EasyButCostly Parking Garage. You will read in the number of hours from the user into a variable of type double and output the parking fees. The parking fees are charged as follows: Hours Fees up to 5 $10 more than 5 but...
Need help with this problem using Python programming as soon as possible, thank you! Write a GUI-based program that implements an image browser for your computer’s file system. The file dialog should filter for GIF image files, and create and open a PhotoImage when a file is accessed.
need help. thank you
T - programming languages concepts
Please let me know if you need more time. Thank you.
Sorry for the inconvenience, please drag the image to a new page
or save it for better view.
need help in solving this. thank
you
need help with this proof thank you.
Please Help! Need in Java C++ Object oriented programming. Thank you! Method 2: public static int sumCapped(int[] nums, int x) This method will return the largest sum that is less than or equal x found in one pass of the array. This means that you must check each number in succession to determine whether or not you should add it in. For example, for the array {4, 2, 3, 5} with the value of the paramter x set to 7,...
I need help with this programming challenge from Starting out with C++ 6th ed. by Gaddis. I am looking for help with Chapter 19 programming challenge 11.
I need help with this assignment, please help! Thank you.
I
need help with this exercise. Thank you for your help
Language is C++
6. Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd inte- ger is prime if it is not divisible by any odd integer less than or equal to the square root of the number.)