PROGRAM C++ PELAYANAN RUMAH SAKIT

PROGRAM C++ PELAYANAN RUMAH SAKIT Konsep: – program C++ berdiagram objek. – jenis program ada INPUT –> OUTPUT.. #include #include using namespace std; // Function prototypes char getChoice(); double patientCharges(int, double, double, double); // In-patient double patientCharges(double, double); // Out-patient int main() { char patientType; // I=in-patient, O=out-patient int days; // Number of days of hospital stay double roomRate, // Daily room rate medication, // Total medication charges services, // Total for tests and other services totalCharges; // Total of all charges // Input and validate patient type cout << “This program will compute patient hospital charges.\n”; cout << “Enter I for in-patient or O for out-patient: “; patientType=getChoice(); //Process the menu selection switch (patientType) { //Inpatient case ‘I’: case ‘i’: cout << “The number of days spent in the hospital: “; cin >> days; cout << “The daily rate: “; cin >> roomRate; cout << “Charges for hospital service: “; cin >> services; cout << “Hospital medicaion charges; “; cin >> medication; cout << totalcharges=”(days*roomRate)” class=”highlight”>hospital services: “; cin >> services; cout << “Hospital medication charges: “; cin >> medication; cout << totalcharges=” services” patienttype =”=” patienttype =”=”> 0.0) cout << “Lab & Services $” <<> 0.0) cout << “Medication $” <<>> letter; // Validate the choice while (letter != ‘I’ && letter != ‘i’ && letter != ‘O’ && letter != ‘o’) { cout << “Enter I or O: “; cin >> letter; } // Return the choice return letter; } /*************************************… * patientCharge * * This function is called by main to calculate and return * * total patient charges for in-patients * **************************************… double patientCharges(int days, double rate, double med, double serv) { return (days*rate) + med + serv; }// end overload function patientCharges /*************************************… * patientCharge * * This function is called by main to calculate and return * * total patient charges for out-patients * **************************************… double patientCharges(double med, double serv) { return med + serv; }// end overload function patientCharges

About hombarpakpahan

student
This entry was posted in PROGRAM C++ PELAYANAN RUMAH SAKIT. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s