Hello sir can you explain me this code in details.
void claimProcess()
{
int id;
bool found = false;
system(\"cls\");
printf(\"Enter patient ID for which you want to claim insurrence:\");
scanf(\"%d\", & id);
int i;
for (i = 0; i < patientCount; i++)
{
if (patients[i].id == id)
{
found = true;
break;
}
}
if (found == false)
{
printf(\"subscriber not found\n\");
return;
}
int numOfDaysHospitalized, suppliesCost,surgicalFee, otherCharges;
bool ICU;
printf(\"How many days were you haspitalized: \");
scanf(\"%d\", & numOfDaysHospitalized);
int ICUFlag;
do {
printf(\"Select A Ward Type\n1-Normal Ward 2-ICU: \");
scanf(\"%d\", & ICUFlag);
} while (ICUFlag < 1 || ICUFlag > 2);
if (ICUFlag == 2)
ICU = true;
else
ICU = false;
printf(\"Enter Cost of Supplies and Services: \");
scanf(\"%d\", & suppliesCost);
printf(\"Enter Surgical Fees: \");
scanf(\"%d\", & surgicalFee);
printf(\"Enter Other Charges: \");
scanf(\"%d\", & otherCharges);
int ICUCharges = 0;
if (ICU == true)
{
if (patients[i].plan == 1)
ICUCharges = numOfDaysHospitalized * 120;
else if (patients[i].plan ==2)
ICUCharges = numOfDaysHospitalized * 150;
else
ICUCharges = numOfDaysHospitalized * 200;
} else
{
if (patients[i].plan == 1)
ICUCharges = numOfDaysHospitalized * 250;
else if (patients[i].plan ==2)
ICUCharges = numOfDaysHospitalized * 400;
else
ICUCharges = numOfDaysHospitalized * 700;
}
int totalClaimAmount = numOfDaysHospitalized +suppliesCost + surgicalFee + otherCharges + ICUCharges;
if (patients[i].annualClaim ==true)
{
if (patients[i].age > 60)
{
printf(\"The subscriber age has exceeded the limit(60 Year), NotEligible\");
return;
}
}
int j;
for (j = 0; j < patientCount; j++)
{
if (claims[j].id == patients[i].id)
break;
}
int amountToBeBorne = 0;
if (totalClaimAmount <=claims[j].remaininigAmount)
{
claims[j].amountClaimed += totalClaimAmount;
claims[j].remaininigAmount -= totalClaimAmount;
} else
{
amountToBeBorne = totalClaimAmount -claims[j].remaininigAmount;
claims[j].amountClaimed += (totalClaimAmount -amountToBeBorne);
claims[j].remaininigAmount = 0;
printf(\"\n\nThe amount that can be claimed is less then theclaim by subscriber. %d RM should be given by subscriberthemselves\n\", amountToBeBorne);
}
FILE * fp;
fp = fopen(\"claims.txt\", \"w\");
for (int i = 0; i fprintf(fp, \"%d,%d,%d,%d\n\", claims[i].id,claims[i].claimedYear, claims[i].amountClaimed,claims[i].remaininigAmount);
fclose(fp);
printf(\"Subscriber ID: %d\nSubscriber Name: %s\nSubscriberClaimed Year: %d\nSubscriber amount Claimed: %d\nSubscriberRemaining Claimed: %d\n\", claims[j].id, patients[i].name,claims[j].claimedYear, claims[j].amountClaimed,claims[j].remaininigAmount);
system(\"pause\");
}