Answer to Question #261204 in C++ for DANIEL

Question #261204

You are required to write a C++ program to assist Dr Plaatje with the running of her surgery. She

needs to know:

1) how many patients she has seen in the month.

2) the five (5) day in which she made most the money, (five highest earning days). If there are

more than one (1) days in which she made the same amount, just indicate that it was

duplicated on a particular day. Only note or record the last duplicate.

3) how much money she has collected in the month.

Also:

(a) Your program must run until the user stops it when the surgery closes at the end of the day,

when the report has to be generated.

(b) Assume a month has 31 days at most.

(c) Your program must ensure that input day is within the range [1..31]. It must not accept days

outside the range.


1
Expert's answer
2021-11-05T00:33:31-0400


#include <iostream>


using namespace std;


int main()
{
    int m[31];
    int num_p[31];
    int money[31];
    int i=0;
    while(true){
        cout<<"\nEnter index of the day: ";
        cin>>m[i];
        cout<<"\nEnter number of patient on day "<<m[i]<<": ";
        cin>>num_p[i];
        cout<<"\nEnter money collected on day "<<m[i]<<": ";
        cin>>money[i];
        
        int c;
        cout<<"\nContinue? 1.Yes 2. No: ";
        cin>>c;
        if (c==2)
            break;
        i++;
    }
    
    int sum=0;
    for(int i=0;i<31;i++){
        sum=sum+num_p[i];
    }
    cout<<"\nNumber of patient in a month = "<<sum;
    
    int sum2=0;
    for(int i=0;i<31;i++){
        sum2=sum2+money[i];
    }
    cout<<"\nAmount of money in a month = "<<sum2;
    


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS