All pastes #961665 Raw Edit

Something

public text v1 · immutable
#961665 ·published 2008-03-29 01:57 UTC
rendered paste body
#include <stdio.h>

struct employee {
	char *name;
	int age;
	int classification;
	int hours_worked;
	float overtime;
	float gross_salary;
	float net_salary;
};

int main (void)
{
	struct employee emp, ovr;
	struct employee data[5] = 
	{ {"John Miller", 42, 2, 38}, {"Michael Wick", 34, 1, 34}, {"Maria Garcia", 30, 3, 25}, 
	{"Jose Garcia", 27, 4, 45}, {"Nathan Aston", 24, 1, 55}
		
	};
	int i; 
	
	printf("Original Data Below \n \n");
	for (i = 0; i<=4; ++i) {
		printf("%s, %i, %i, %i \n", data[i].name, data[i].age, data[i].classification, data[i].hours_worked);
		
		if(data[i].hours_worked < 41) {
			
			if(data[i].classification == 1){
				emp.net_salary = data[i].hours_worked * 10.25;
			}	//end of class 1 
			
			if(data[i].classification ==2){
				emp.net_salary = data[i].hours_worked *8.50;
			}	//end of class 2
		
			if(data[i].classification == 3) {
				emp.net_salary = data[i].hours_worked *6.30;
			
			}	//end of class 3
			
			if (data[i].classification == 4) {
				emp.net_salary = data[i].hours_worked *4.65;
			}	//end of class 4
		
		} 	// end of if loop <= 40 hours
	
	else{
		
		if(data[i].classification == 1){
			
			emp.overtime = (data[i].hours_worked - 40) * 10.25;
			emp.net_salary = data[i].hours_worked *10.25 + emp.overtime;
			
		}	//end of class 1 
		
		if(data[i].classification ==2){
			
			emp.overtime = (data[i].hours_worked - 40) *8.50;
			emp.net_salary = data[i].hours_worked *8.50 + emp.overtime;
			
		}	//end of class 2
	
		if(data[i].classification == 3) {
			emp.overtime = (data[i].hours_worked - 40) * (6.30 *1.5);
			
			emp.net_salary = data[i].hours_worked *6.30 + emp.overtime;
			
		}	//end of class 3
		
		if (data[i].classification == 4) {
			
			emp.overtime = (data[i].hours_worked - 40) *(4.65 * 1.5);
			
			emp.net_salary = data[i].hours_worked *4.65 + emp.overtime;
			
		}	//end of class 4
		
		
	}	//end of overtime else loop
	
	}	//end of for loop
	
	
	return 0;
}