In: Computer Science
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:
Develop an algorithm, flow chart and write a Looping in C program to read the gender of
patients and fees to be paid by them as shown in the below table. Calculate the
total fees paid by the female and male patients separately and display them
with appropriate statements.
Patient Id |
Fees in (OMR) |
Gender |
P001 |
15 |
M |
P002 |
10 |
F |
P003 |
20 |
M |
P004 |
8 |
F |
P005 |
12 |
M |
//C program to compute total fees gender wise
#include <stdio.h>
int main() {
char patientId[20];
char gender;
int fees, mtotal, ftotal, i;
mtotal = 0;
ftotal = 0;
for (i = 1; i <= 5; i++) {
printf("Enter PatientId,Fees and gender :\n");
scanf("%s %d %c",patientId,&fees,&gender);
if (gender == 'M') {
mtotal = mtotal + fees;
} else {
ftotal = ftotal + fees;
}
}
printf( "Total fees paid by the female : %d \n",ftotal);
printf( "Total fees paid by the male : %d ", mtotal);
return 0;
}
Function Main
Declare String PatientId, gender
Declare Integer fees, mtotal, ftotal, i
Assign mtotal = 0
Assign ftotal = 0
For i = 1 to 5
Input PatientId
Input fees
Input gender
If gender="M"
Assign mtotal = mtotal+fees
False:
Assign ftotal = ftotal+fees
End
End
Output "Total fees paid by the female : "
Output ftotal
Output "Total fees paid by the male : "
Output mtotal
End