#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. 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.
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,...
need help in solving this. thank
you
need help with this proof thank you.
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.
Please help me to make this c programming code!! Thank
you!!
Concatenation of two strings using pointers Step 1: Ask the user to input ni,n2 and create two character arrays (strings) with ni, n2 size using malloc. Step 2: create a 3rd array using malloc of size(n1+n2). Step 3: Ask the user to input String1 (of size nl) Step 4: Ask the user to input String2 (of size n2) Step 5: concatenate the two arrays and store them in String3...
Would you please help me to do this problem? this is c programming. 1. write figures of inserting 3 elements into a stack linked list and a queue linked list with code fragments and then delete 2 elements from each with associated code fragments. thank you.