Answer to Question #235029 in C for New

Question #235029
Write a program to calculate the salary as per the following table:

Gender

Years of Service

Qualifications

Salary (RTGS)

Male

>= 10

Post-Graduate

$15 000

>= 10

Graduate

$10 000

< 10

Post-Graduate

$10 000

< 10

Graduate

$7 000

Female

>= 10

Post-Graduate

$12 000

>= 10

Graduate

$9 000

< 10

Post-Graduate

$10 000

< 10

Graduate

$6 000
1
Expert's answer
2021-09-09T04:09:56-0400


#include<stdio.h>
#include<string.h>
int main(){
	char gender[10];
	char Qualifications[20] ;
	int YearOfService ;
  int  Salary ;
    printf("Enter gender. In this format: Female or Male\n");
	scanf("%s", &gender);
	
	printf("Enter year of service\n");
	scanf("%d", &YearOfService);
	
	
	printf("Enter Qualifications. In this format: Post-Graduate or Graduate\n");
	scanf("%s", &Qualifications);
	
	
	if((strcmp(gender,"Male") == 0) && YearOfService>= 10 && (strcmp(Qualifications,"Post-Graduate") == 0)){
		printf("The salary is:  $ 15,000");
		
	}
	
	else if((strcmp(gender,"Male") == 0) && YearOfService>= 10 && (strcmp(Qualifications,"Graduate") == 0)){
		printf("The salary is:  $ 10,000");
		
	}
	
	else if((strcmp(gender,"Male") == 0) && YearOfService<10 && (strcmp(Qualifications,"Post-Graduate") == 0)){
		printf("The salary is:  $ 10,000");
		
	}
	else if((strcmp(gender,"Male") == 0) && YearOfService<10 && (strcmp(Qualifications,"Graduate") == 0)){
		printf("The salary is:  $ 7,000");
		
	}
	
	else if((strcmp(gender,"Female") == 0) && YearOfService>=10 && (strcmp(Qualifications,"Post-Graduate") == 0)){
		printf("The salary is:  $ 12,000");
		
	}
	
	else if((strcmp(gender,"Female") == 0) && YearOfService>=10 && (strcmp(Qualifications,"Graduate") == 0)){
		printf("The salary is:  $ 9,000");
		
	}
	
	
	else if((strcmp(gender,"Female") == 0) && YearOfService<10 && (strcmp(Qualifications,"Post-Graduate") == 0)){
		printf("The salary is:  $ 10,000");
		
	}
	
	else if((strcmp(gender,"Female") == 0) && YearOfService<10 && (strcmp(Qualifications,"Graduate") == 0)){
		printf("The salary is:  $ 6,000");
		
	}
	
	
	
	
}

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!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS