A Private Poly Clinic in City wish to develop software to automate their Patient Monitoring system for storing the details of the patients visited the clinic. Develop a system to meet the following requirements:
Patient Id |
Fees in (OMR) |
Gender |
P001 |
15 |
M |
P002 |
10 |
F |
P003 |
20 |
M |
P004 |
8 |
F |
P005 |
12 |
M |
ALGORITHM:
Step by step descriptive logic to compute Private Poly Clinic:
1. Take the required details such as PatientID, Fees, and gender.
2. If the age is greater than 60, fees+=*.15
3. Display the fees.
( I hope you can write a flowchart through the above algorithm)
C Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct clinic
{
char pid[4];
float fee;
char gender;
int age;
};
float fees(float fee, int age)
{
if(age>60)
fee*=0.85;
return fee;
}
int main()
{
int n,i;
struct clinic *s;
printf("Enter the number of entries to be made:
");
scanf("%d",&n);
s=(struct clinic *)malloc(n*sizeof(struct
clinic));
printf("Enter the data into the system:\n");
for(i=0; i<n; i++)
{
printf("\n\nFor Patient
%03d:\n\n",i+1);
fflush(stdin);
printf("Enter the Patient ID:
");
gets(s[i].pid);
fflush(stdin);
printf("Enter the age: ");
scanf("%d",&s[i].age);
printf("Enter the fees: ");
scanf("%f",&s[i].fee);
s[i].fee=fees(s[i].fee,s[i].age);
while(1)
{
fflush(stdin);
printf("Enter
the Gender(M/F): ");
scanf("%c",&s[i].gender);
if(s[i].gender=='m'||s[i].gender=='f')
s[i].gender-=32;
if(s[i].gender!='M'&&s[i].gender!='F')
printf("Invalid input, try again?\n");
else
break;
}
}
printf("Displaying the data:\n\n");
printf("Patient ID\tFees in
(OMR)\tGender\tAge\n");
printf("----------\t-------------\t------\t---\n");
for(i=0; i<n; i++)
{
printf("%-10s\t%-13f\t%-6c\t%-3d\n",s[i].pid,s[i].fee,s[i].gender,s[i].age);
}
return 0;
}
A Private Poly Clinic in City wish to develop software to automate their Patient Monitoring system...
A Private Poly Clinic in Oman wish to develop software to automate their Patient Monitoring system for storing the details of the patients visited the clinic. Develop a system to meet the following requirements: The clinic wish to give 15% discount on the fees to be paid by the patients whose age is above 60. Develop an algorithm, flow chart and write a C program to read age of the patient and calculate the fees after the discount by writing...
Use c program to: The clinic wish to give 15% discount on the fees to be paid by the patients whose age is above 60. Develop an algorithm, flow chart and write a C program to read age of the patient and calculate the fees after the discount by writing a function with argument. Display the result with appropriate statements.