Hello sir can you explain me this code in details. void claimProcess() { int id; bool found = false; system(\"cls\"); printf(\"Enter...

80.2K

Verified Solution

Question

Programming

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\");

}

Answer & Explanation Solved by verified expert
3.6 Ratings (502 Votes)
Function void claimProcess function claimProcessno return type int id bool found false systemcls clearing the screen printfEnter patient ID for which you want to claim insurrence scanfd id Input id int i for i 0 i patientCount i Loop upto Total patient if patientsiid id if input id matches the patient id that means patient founded found true break if found false if patient not found then exit the program printfsubscriber not foundn return int    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students