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 59
|
#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
double Patient(int Days, double DailyRate, double Charges, double MedicationCharges);
double Patient(double Charges, double MedicationCharges);
int main()
{
//Variables:
int Days = 0,
Choice = 0;
double DailyRate = 0,
Charges = 0,
TotalInPatient = 0,
TotalOutPatient = 0,
MedicationCharges = 0;
//Start:
cout << "Enter 1 if they were an In-Patient, enter 2 if they were an Out-Patient" << endl;
cin >> Choice;
if (Choice == 1);
{ cout << "How many days were spent in the hosptial?" << endl;
cin >> Days;
cout << "What was the daily rate?" << endl;
cin >> DailyRate;
cout << "What were the charges for the visit?" << endl;
cin >> Charges;
cout << "What were the medication charges?" << endl;
cin >> MedicationCharges;
TotalInPatient = Patient(Days, DailyRate, Charges, MedicationCharges);
cout << fixed << showpoint << setprecision(2);
cout << "The total is: $" << TotalInPatient << endl;
exit(0);
}
else if (Choice == 2);
{ cout << "What were the charges for the visit?" << endl;
cin >> Charges;
cout << "What were the medication charges?" << endl;
cin >> MedicationCharges;
TotalOutPatient = Patient(Days, DailyRate, Charges, MedicationCharges);
cout << fixed << showpoint << setprecision(2);
cout << "The total is: $" << TotalOutPatient << endl;
exit(0);
}
}
//In-Patient Data:
double Patient(int Days, double DailyRate, double Charges, double MedicationCharges)
{
return ((Days * DailyRate) + Charges + MedicationCharges);
}
//Out-Patient Data:
double Patient(double Charges, double MedicationCharges)
{
return (Charges + MedicationCharges);
}
|