Need help with a credit card program
I'm trying to get my code to assign a credit card type of Bronze, Silver, Gold, or Platinum based on these conditions
CCTYPE AGE_REQ SAL_REQ REF_REQ YEA_REQ
Bronze Yes Yes No <2
Silver Yes Yes No >=2
Gold Yes Yes Yes <2
Platinum Yes Yes Yes >=2
How would i code it to make it check the conditions AGE_REQ, SAL_REQ, REF_REQ, YEA_REQ and assign a CC Type
Here's my code for the rest of the program
Code:
#include <stdio.h>
int main() {
int AGE_REQ, SAL_REQ, REF_REQ, request_number = 1, runAgain = 1;
float YEA_REQ;
do{printf("************* Credit Card Program (Request# <%d>)\n", request_number);
printf("Age greater or equal than 15 (1->Yes, 0->No) ?: ");
scanf("%d", &AGE_REQ);
printf("Salary greater or equal than 40K (1->Yes, 0->No) ?: ");
scanf("%d", &SAL_REQ);
printf("Any references (1->Yes, 0->No) ?: ");
scanf("%d", &REF_REQ);
printf("Enter years in current job: ");
scanf("%f", &YEA_REQ);
if (YEA_REQ < 0 || YEA_REQ > 90) {
do {printf("INVALID years value\n");
printf("Enter years in current job: ");
scanf("%f", &YEA_REQ);
} while(YEA_REQ < 0 || YEA_REQ > 90);
}
printf("************* Information provided *************\n");
if (AGE_REQ == 1) {
printf("Age greater or equal to 15\n");
} else if (AGE_REQ == 0) {
printf("Age less than 15\n");
}
if (SAL_REQ == 1) {
printf("Salary greater or equal than 40k\n");
} else if (SAL_REQ == 0) {
printf("Salary less than 40k\n");
}
if (REF_REQ == 1) {
printf("References availible\n");
} else if (REF_REQ == 0) {
printf("No references\n");
}
printf("Years in current job: %.1f\n", YEA_REQ);
printf("Do you want to run the classification Program again? (1->Yes, 0->No): ");
scanf("%d", &runAgain);
request_number ++;
} while (runAgain == 1);
printf("Thanks for using the Credit Card program\n");
return 0;
}