Question

Can you give conclusion of this code. in one paragraph. #define _CRT_SECURE_NO_DEPRECATE #include #include #include #include...

Can you give conclusion of this code. in one paragraph.

#define _CRT_SECURE_NO_DEPRECATE
#include
#include
#include
#include
#include
struct patient {
int id;
int age;
bool annualClaim;
int plan;
char name[30];
char contactNum[15];
char address[50];
};
#define MAX_LENGTH 500
struct patient patients[100];
int patientCount = 0;
struct claim {
int id;
int claimedYear;
int amountClaimed;
int remaininigAmount;
};
struct claim claims[100];
void subscribe()
{
system("cls");
patients[patientCount].id = patientCount + 1;
printf("Enter age: ");
scanf("%d", & patients[patientCount].age);
printf("\n\n%-25sHealth Insurence Plan\n\n", " ");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20s|%-20s|%-20s|\n", " ", "Plan 120(RM)", "Plan 150(RM)", "Plan 200(RM)");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20d|%-20d|%-20d|\n", "Monthly Premium", 120, 150, 200);
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20d|%-20d|%-20d|\n", "Annual Claim Limit", 120000, 150000, 200000);
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20d|%-20d|%-20d|\n", "Lifetime Claim Limit", 600000, 750000, 1000000);
printf("-----------------------------------------------------------------------------------------------\n");
printf("\n\n%-25sAge Group and Health Insurence Plan\n\n", " ");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-25s%-30s\n", "Types of Claim", " ", "Eligibility Amount");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20s|%-20s|%-20s|\n", " ", "Plan 120(RM)", "Plan 150(RM)", "Plan 200(RM)");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20s|%-20s|%-20s|\n", "Room Charges", "120/day", "150/day", "200/day");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20s|%-20s|%-20s|\n", "Intensive Care Unit", "250/day", "400/day", "700/day");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20s|%-20s|%-20s|\n", "Hospital Supplies and Services", " ", " ", " ");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-60s|\n", "Surgical Fees", "As charged Sbject to approval by ZeeMediLife");
printf("-----------------------------------------------------------------------------------------------\n");
printf("|%-30s|%-20s|%-20s|%-20s|\n", "Other Fees", " ", " ", " ");
printf("-----------------------------------------------------------------------------------------------\n\n");
int ch;
do {
printf("Select a Claim Limit Type\n1-Annual Claim Limit 2-Lifetime Claim Limit: ");
scanf("%d", & ch);
} while (ch < 1 || ch > 2);
if (ch == 1)
patients[patientCount].annualClaim = true;
else
patients[patientCount].annualClaim = false;
do {
printf("Select a plan\n1-Plan120 2-Plan150 3-Plan200: ");
scanf("%d", & ch);
} while (ch < 1 || ch > 3);
patients[patientCount].plan = ch;
printf("Enter Name: ");
scanf("%s", & patients[patientCount].name);
printf("Contact Number: ");
scanf("%s", & patients[patientCount].contactNum);
printf("Enter Address: ");
scanf("%s", & patients[patientCount].address);
FILE * fp;
fp = fopen("patients.txt", "a");
fprintf(fp, "%d,%s,%d,%d,%d,%s,%s\n", patients[patientCount].id, patients[patientCount].name, patients[patientCount].age, patients[patientCount].annualClaim, patients[patientCount].plan, patients[patientCount].contactNum, patients[patientCount].address);
fclose(fp);
time_t s;
struct tm * currentTime;
s = time(NULL);
currentTime = localtime( & s);
claims[patientCount].id = patients[patientCount].id;
claims[patientCount].amountClaimed = 0;
claims[patientCount].claimedYear = currentTime -> tm_hour + 1900;
if (patients[patientCount].annualClaim == true)
{
if (patients[patientCount].plan == 1)
claims[patientCount].remaininigAmount = 120000;
else if (patients[patientCount].plan == 2)
claims[patientCount].remaininigAmount = 150000;
else
claims[patientCount].remaininigAmount = 200000;
} else
{
if (patients[patientCount].plan == 1)
claims[patientCount].remaininigAmount = 600000;
else if (patients[patientCount].plan == 2)
claims[patientCount].remaininigAmount = 750000;
else
claims[patientCount].remaininigAmount = 1000000;
}
patientCount++;
fp = fopen("claims.txt", "a");
if (fp == NULL)
printf("File Dont exist");
fprintf(fp, "%d,%d,%d,%d\n", claims[patientCount].id, claims[patientCount].claimedYear, claims[patientCount].amountClaimed, claims[patientCount].remaininigAmount);
fclose(fp);
system("pause");
}
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), Not Eligible");
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 the claim by subscriber. %d RM should be given by subscriber themselves\n", amountToBeBorne);
}
FILE * fp;
fp = fopen("claims.txt", "w");
for (int i = 0; i < patientCount; 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\nSubscriber Claimed Year: %d\nSubscriber amount Claimed: %d\nSubscriber Remaining Claimed: %d\n", claims[j].id, patients[i].name, claims[j].claimedYear, claims[j].amountClaimed, claims[j].remaininigAmount);
system("pause");
}
void accountInfo()
{
system("cls");
int ch;
printf("1-Total Amount Claimed by LifeTime Claim Limit subscriber\n");
printf("2-Total number of Annual Claim Limit who have exhausted all their eligible amount\n");
scanf("%d", & ch);
if (ch == 1)
{
int totalAmountClaimedByLifeTimeSubs = 0;
for (int i = 0; i < patientCount; i++)
{
if (patients[i].annualClaim == false)
{
for (int j = 0; j < patientCount; j++)
{
if (claims[j].id == patients[i].id)
{
totalAmountClaimedByLifeTimeSubs += claims[j].amountClaimed;
}
}
}
}
printf("\nTotal amount Claimed By LifeTime Subscribers is: %d\n", totalAmountClaimedByLifeTimeSubs);
} else
{
int count = 0;
for (int i = 0; i < patientCount; i++)
{
if (claims[i].remaininigAmount <= 0 && patients[i].annualClaim == true)
count++;
}
printf("Total number of Annual Claim Limit Subcriber who have exhausted all their amount are: %d\n", count);
}
system("pause");
}
void searchingFunctionalities()
{
system("cls");
int ch;
printf("1-Search by ID\n2-Search by age\n");
scanf("%d", & ch);
if (ch == 1)
{
int id;
printf("Enter patient ID for which you want Search: ");
scanf("%d", & id);
int i;
for (i = 0; i < patientCount; i++)
{
if (patients[i].id == id)
{
printf("\nSubscriber Name: %s\nSubscriber Age: %d\nSubscriber Contact: %s\nSubscriber Address: %s\n", patients[i].name, patients[i].age, patients[i].contactNum, patients[i].address);
break;
}
}
printf("Subscriber Not Found");
} else
{
int age;
printf("Enter age for which you want Search: ");
scanf("%d", & age);
for (int i = 0; i < patientCount; i++)
{
if (patients[i].age == age)
{
printf("\nSubscriber Name: %s\nSubscriber ID: %d\nSubscriber Contact: %s\nSubscriber Address: %s\n", patients[i].name, patients[i].id, patients[i].contactNum, patients[i].address);
}
}
}
system("pause");
}
void loadData()
{
char line[MAX_LENGTH];
const char * delimiter = ",\n";
FILE * fp;
fp = fopen("patients.txt", "r");
char c;
if (fp == NULL)
{
printf("file not found");
return;
}
while (fp != NULL)
{
if (fgets(line, MAX_LENGTH - 1, fp) == NULL)
break;
if (line[1] == '\0')
break;
patients[patientCount].id = atoi(strtok(line, delimiter));
strcpy(patients[patientCount].name, strtok(NULL, delimiter));
patients[patientCount].age = atoi(strtok(NULL, delimiter));
patients[patientCount].annualClaim = strtok(NULL, delimiter);
patients[patientCount].plan = atoi(strtok(NULL, delimiter));
strcpy(patients[patientCount].contactNum, strtok(NULL, delimiter));
strcpy(patients[patientCount].address, strtok(NULL, delimiter));
strcpy(line, "\0");
patientCount++;
}
fclose(fp);
fp = fopen("claims.txt", "r");
int claimCount = 0;
while (fp != NULL)
{
if (fgets(line, MAX_LENGTH - 1, fp) == NULL)
break;
if (line == "\n")
break;
claims[claimCount].id = atoi(strtok(line, delimiter));
claims[claimCount].claimedYear = atoi(strtok(NULL, delimiter));
claims[claimCount].amountClaimed = atoi(strtok(NULL, delimiter));
claims[claimCount].remaininigAmount = atoi(strtok(NULL, delimiter));
strcpy(line, "\0");
claimCount++;
}
fclose(fp);
}
int menu()
int ch;
do {
system("cls");
printf("Select one of the below option to continue\n");
printf("1-Insurence Plan Subscription\n");
printf("2-Claim Processing\n");
printf("3-Accounts Information\n");
printf("4-Searching Functionalities\n");
printf("5-Exit\n");
scanf("%d", & ch);
} while (ch > 5 || ch < 1);
return ch;
}
int main()
{
int ch;
loadData();
do {
ch = menu();
if (ch == 1)
subscribe();
else if (ch == 2)
claimProcess();
else if (ch == 3)
accountInfo();
else if (ch == 4)
searchingFunctionalities();
else
break;
} while (ch != 5);
system("pause");
return 0;
}

Homework Answers

Answer #1

This program is for a health care institution that provides bed to ill patients. The program calculates the total charges occured during the stay of the patient and then this amount is deducted by the patients health plans accordingly. The remaining amount is supposed to be paid by the patient. Some of the variables taken into account are the Plan(120(RM),Plan 150(RM),Plan 200(RM), Monthly Premium(120, 150, 200), Annual Claim Limit(120000, 150000, 200000), Lifetime Claim Limit( 600000, 750000, 1000000), Age Group and Health Insurence Plan,Types of Claim, Eligibility Amount, Room Charges (120/day, 150/day, 200/day), Intensive Care Unit(250/day, 400/day, 700/day)., Hospital Supplies and Services, Surgical Fees (As charged Subject to approval by ZeeMediLife) and Other Fees.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Explain this code function by function in detail int menu() {   int choice;   do {     system("cls");...
Explain this code function by function in detail int menu() {   int choice;   do {     system("cls");     printf("1-Insurence Plan Subscription\n");     printf("2-Claim Processing\n");     printf("3-Accounts Information\n");     printf("4-Searching Functionalities\n");     printf("5-Exit\n");     scanf("%d", &choice);   } while (choice > 5 || choice < 1);   return choice; void subscribe() system("cls");   victims[userCount].id = userCount + 1;   printf("Enter age: ");   scanf("%d", &victims[userCount].age);   printf("\n\n%-25sHealth Insurence Plan\n\n", " ");   printf("-----------------------------------------------------------------------------------------------\n");   printf("|%-30s|%-20s|%-20s|%-20s|\n", " ", "Plan 120(RM)", "Plan 150(RM)", "Plan 200(RM)");   printf("-----------------------------------------------------------------------------------------------\n");   printf("|%-30s|%-20d|%-20d|%-20d|\n", "Monthly Premium", 120, 150, 200);   printf("|%-30s|%-20d|%-20d|%-20d|\n", "Annual Claim Limit", 120000,150000,200000);   printf("|%-30s|%-20d|%-20d|%-20d|\n",...
Design flow chart of this code and make sure it is not handwritten it must on...
Design flow chart of this code and make sure it is not handwritten it must on some software. struct user {    int id;    int age;    bool annualClaim;    int plan;    char name[30];    char contactNum[15];    char address[50]; }; #define MAX_LENGTH 500 struct user users[100]; int userCount = 0; struct claim {    int id;    int claimedYear;    int amountClaimed;    int remaininigAmount; }; struct claim claims[100]; void loadData() {    char line[MAX_LENGTH];    const...
Design flow chart on software not handwritten. void claimProcess() {    int id;    bool found...
Design flow chart on software not handwritten. void claimProcess() {    int id;    bool found = false;    system("cls");       printf("Enter user ID for which you want to claim insurrence: ");    scanf("%d", &id);    int i;    for (i = 0; i < userCount; i++)    {        if (users[i].id == id)        {            found = true;            break;        }    }    if (found == false)   ...
Construct a flowchart based on this code and write its equivalent algorithms. #include <stdio.h> int main()...
Construct a flowchart based on this code and write its equivalent algorithms. #include <stdio.h> int main() { int x,y; float result; char ch; //to store operator choice printf("Enter first number: "); scanf("%d",&x); printf("Enter second number: "); scanf("%d",&y); printf("Choose operation to perform (+,-,*,/): "); scanf(" %c",&ch); result=0; switch(ch) { case '+': result=x+y; break; case '-': result=x-y; break; case '*': result=x*y; break; case '/': result=(float)x/(float)y; break; case '%': result=x%y; break; default: printf("Invalid operation.\n"); } printf("Result: %d %c %d = %.2f\n",x,ch,y,result); // Directly...
The code is in C programming language pls convert it into python. Thanks. Program --> #include...
The code is in C programming language pls convert it into python. Thanks. Program --> #include <stdio.h> #include <stdlib.h> void main() { //declare variables FILE *fileptr; char filename[15]; char charRead; char filedata[200],searchString[50]; int i=0,j=0,countNoOfWord=0,count=0; //enter the filename to be opened printf("Enter the filename to be opened \n"); scanf("%s", filename); /* open the file for reading */ fileptr = fopen(filename, "r"); //check file exit if (fileptr == NULL) { printf("Cannot open file \n"); exit(0); } charRead = fgetc(fileptr); //read the string...
This is my code and can you please tell me why it's not working? By the...
This is my code and can you please tell me why it's not working? By the way, it will work if I reduce 10,000,000 to 1,000,000. #include <iostream> using namespace std; void radixSort(int*a, int n) { int intBitSize = sizeof(int)<<3; int radix = 256; int mask = radix-1; int maskBitLength = 8;    int *result = new int[n](); int *buckets = new int[radix](); int *startIndex = new int[radix]();    int flag = 0; int key = 0; bool hasNeg =...
C CODE PLZ! Need all TO DO sections finished thanks #include <stdio.h> int main(int argc, char...
C CODE PLZ! Need all TO DO sections finished thanks #include <stdio.h> int main(int argc, char **argv) { const int BUF_LEN = 128; char str[BUF_LEN]; int i; char c; int is_binary; int d, n; /* Get the user to enter a string */ printf("Please enter a string made of 0s and 1s, finishing the entry by pressing Enter.\n"); for (i=0; i<BUF_LEN-1; i++) { scanf("%c", &c); if (c == '\n') { break; } str[i] = c; } str[i] = '\0'; /*...
Can you translate this C code into MIPS assembly with comment? #include <stdio.h> #include <math.h> #include...
Can you translate this C code into MIPS assembly with comment? #include <stdio.h> #include <math.h> #include <stdlib.h> double fact (double); void main () { int angle_in_D; double term, angle_in_R; float sine = 0; unsigned int i = 1; double sign = 1; int n = 1000; printf ("Please enter an angle (Unit: Degree): "); scanf ("%d", &angle_in_D); angle_in_R = angle_in_D * M_PI / 180.0; do { term = pow(-1,(i-1)) * pow (angle_in_R, (2*i - 1)) / fact (2*i - 1);...
0001 #include <stdio.h> 0002 0003 #define NUM_PRODUCTS 2 0004 #define NUM_CATEGORIES 2 0005 #define NUM_DIGITS 2...
0001 #include <stdio.h> 0002 0003 #define NUM_PRODUCTS 2 0004 #define NUM_CATEGORIES 2 0005 #define NUM_DIGITS 2 0006 0007 struct ProductInfo 0008 { 0009     int prodID; 0010     int numberInStock; 0011     double unitPrice; 0012 }; 0013 0014 int main(void) 0015 { 0016     struct ProductInfo productList[NUM_PRODUCTS] = 0017     { 0018         {78, 8, 19.95}, 0019         {95, 14, 22.98} 0020     }; 0021 0022     int categoryCount[NUM_CATEGORIES] = { 0 }; 0023 0024     int i,...
"C language" Take this code and make the minor modification necessary to create a circular linked...
"C language" Take this code and make the minor modification necessary to create a circular linked list (Hint: Store a pointer to the first node in the next pointer of the last node.) Demonstrate that this is working by traversing the list until the first pointer is encountered 3 times. Next redefine the node structure to include a back pointer. This will enable your program to move from front to back and then from back to front. It is not...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT