Question #44343

Perera & Sons maintain their Employee Records (Maximum 10) in the following manner. Write Program for the following.






Option One
This option should allow you to enter the employee’s details. You have to enter the EmpNo, EmpName, Age and Salary. (Maximum of 10 records, but need not to be 10)

Option Two
This option must display All the employee’s details, in the following format.

Employee No. Name Age Salary
1000 Sam 26 5000
1001 Peter 27 4500
1002 Tony 25 6000
--- --- -- ---
--- --- -- ---

Option Three
This must allow you to enter the Over time rate and Over time hours for the Employee No.’s you have entered already. Over time rate must be a unique value for all employees. It has to calculate the Over time Amount and display that also.

(Over time Amount = Over time rate X Over time Hours)




Option Four
This option has to display the Employee’s Gross Wage and Bonus details in the following format.

(Gross Wage=Salary + Over time Amount)

Gross Wage Bonus
<3000 No Bonus
3000 – 4499 10% of the GW
4500 – 5999 15% of the GW
>=6000 25% of the GW

Employee No. Name Gross Wage Bonus
1000 Sam Value Value
1001 Peter Value Value
1002 Tony Value Value
1003 John Value Value
--- --- --- ---
--- --- --- ---
--- --- --- ---

Write the program with proper functions/procedures.
1

Expert's answer

2014-07-23T11:30:17-0400
#include <stdio.h>
#include <stdlib.h>
int main()
{
// counters
int i;
int j;
int choose = 0;
// amount of students
int n = 3;
// employee No.
int no[10] = {};
// employee name
char name[][10] = {};
// employee age
int age[10] = {};
// employee salary
int salary[10] = {};
// employee over time hours
float hours[10] = {};
// employee bonus
float bonus[10] = {};
// over time rate
float overTimeRate;
// over time amount
float overTimeAmount;
// Option One
void read() {
printf("Enter the amount of employees: ");
scanf("%d", &n);
for(i = 0; i < n; i++) {
printf("Enter student employee no: ");
scanf("%d", &no[i]);
printf("Enter student employee name: ");
scanf("%s", name[i]);
printf("Enter student employee age: ");
scanf("%d", &age[i]);
printf("Enter student employee salary: ");
scanf("%d", &salary[i]);
}
return;
}
// Option Two
void printOut() {
printf("Employee No. Name Age Salary\n");
for(i = 0; i < n; i++) {
printf("%d ", no[i]);
printf("%s ", name[i]);
printf("%d ", age[i]);
printf("%d\n", salary[i]);
}
return;
}
// Option Three
void amount() {
printf("Enter over time rate: ");
scanf("%f", &overTimeRate);
for(i = 0; i < n; i++) {
printf("Enter over time hours for %d: ", no[i]);
scanf("%f", &hours[i]);
}
for(i = 0; i < n; i++) {
printf("Over time amount for %d ", no[i]);
overTimeAmount = hours[i] * overTimeRate;
printf("is %f\n", overTimeAmount);
}
}
// Option Four
void gwBonus() {
for(i = 0; i < n; i++) {
float gw;
float gwb;
gw = hours[i] * overTimeRate + salary[i];
if (gw < 3000) {
gwb = 0;
}
if ((3000 <= gw) && (gw < 4499)) {
gwb = 0.1;
}
if ((4500 <= gw) && (gw < 5999)) {
gwb = 0.15;
}
if (6000 <= gw) {
gwb = 0.25;
}
bonus[i] = gw * gwb;
}
printf("Employee No. Name Gross Wage Bonus\n");
for(i = 0; i < n; i++) {
printf("%d ", no[i]);
printf("%s ", name[i]);
printf("%f\n", bonus[i]);
}
return;
}
while (choose != 5) {
printf("(1) Option One\n");
printf("(2) Option Two\n");
printf("(3) Option Three\n");
printf("(4) Option Four\n");
printf("(5) Exit\n");
scanf("%d", &choose);
if (choose == 1) {
read();
}
if (choose == 2) {
printOut();
}
if (choose == 3) {
amount();
}
if (choose == 4) {
gwBonus();
}
}
return 0;
}


http://www.AssignmentExpert.com/

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS