Question

A Private Poly Clinic in City wish to develop software to automate their Patient Monitoring system...

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
  1. 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.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

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;
}
  

Add a comment
Know the answer?
Add Answer to:
A Private Poly Clinic in City wish to develop software to automate their Patient Monitoring system...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A Private Poly Clinic in Oman 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...

    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.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT