1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
# include <iostream>
using namespace std;
double calccharges(double days,double dailyrate,double hospmedcharges,double hospserv,double totalcharges);
//returns value for inpatient
double calccharges(double hospserv,double totalcharges);
//returns value for outpatient
double calccharges(double days,double dailyrate,double hospmedcharges,double hospserv,double totalcharges)
{
totalcharges=((days*dailyrate)+hospmedcharges+hospserv);
return totalcharges;
}
double calccharges(double hospmedcharges1,double hospserv1, double totalcharges1)
{
totalcharges1=hospmedcharges1+hospserv1;
return totalcharges1;
}
int main ()
{ string patienttype,inpatient,outpatient;
double days,dailyrate,hospmeds,services,total;
cout<<"is the patient an outpatient or an inpatient :";
cin>>patienttype;
if (patienttype == inpatient)
{cout<<"Input the number or days spent at the hospital : ";
cin>>days;
cout<<"input the daily rate : ";
cin>>dailyrate;
cout<<"input hospital medication charges : ";
cin>>hospmeds;
cout<<"input the charges for hospital services :";
cin>>services;
}
else
{ cout<<"this is an outpatient "<<endl;
cout<<"input hospital medication charges : ";
cin>>hospmeds;
cout<<"input the charges for hospital services :";
cin>>services;
}
cout <<"totalcharges for inpatient are :" <<calccharges(days,dailyrate,hospmeds,services,total)<<endl;
cout <<"totalcharges for outpatients are :"<<calccharges(hospmeds,services,total)<<endl;
return 0;
}
|