Ok I have everything pretty much working except for one small detail. When I do inpatient I need to display the room charges as well as the medication and labs and services. It only displays the medication and labs and services charges but in the total includes the room charges, but is not showing them.

Thanks.

#include <iostream>
#include <iomanip>
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 << patientCharges (days, roomRate, services, medication) << endl;
		totalCharges=(days*roomRate) + services + medication;
		break;

		//Outpatient
	case 'O':																
	case 'o':	cout << "Charges for hospital services: ";
		cin >> services;
		cout << "Hospital medication charges: ";
		cin >> medication;
		cout << patientCharges (services, medication) << endl;
		totalCharges= services + medication;
	}



	// Display the billing statment
	cout << fixed << showpoint << setprecision(2) << endl << endl;
	cout << "******************************\n";
	if (patientType == 'I' && patientType == 'i')
		cout << "Room charges    $" << setw(8) << days*roomRate << endl;
	if (services > 0.0)
		cout << "Lab & Services  $" << setw(8) << services << endl;
	if (medication > 0.0)
		cout << "Medication      $" << setw(8) << medication << endl;
	cout    << "Total charges   $" << setw(8) << totalCharges << endl;
	cout << "******************************\n";



	return 0;
}// End of main function

//***********************************************************
// Definition of function getChoice                         *
// Accepts and returns user's validated menu choice.        *
//***********************************************************
char getChoice()
{
	char letter;        // Holds user's letter choice

	// Get the user's choice
	cin >> 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

Got it fixed.

Changed

if (patientType == 'I' && patientType == 'i')

to

if (patientType == 'I' || patientType == 'i')

In the part that display the billing statement

#include <iostream>
#include <iomanip>
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 << patientCharges (days, roomRate, services, medication) << endl;
		totalCharges=(days*roomRate) + services + medication;
		break;

		//Outpatient
	case 'O':																
	case 'o':	cout << "Charges for hospital services: ";
		cin >> services;
		cout << "Hospital medication charges: ";
		cin >> medication;
		cout << patientCharges (services, medication) << endl;
		totalCharges= services + medication;
	}



	// Display the billing statment
	cout << fixed << showpoint << setprecision(2) << endl << endl;
	cout << "******************************\n";
	if (patientType == 'I' || patientType == 'i')
		cout << "Room charges    $" << setw(8) << days*roomRate << endl;
	if (services > 0.0)
		cout << "Lab & Services  $" << setw(8) << services << endl;
	if (medication > 0.0)
		cout << "Medication      $" << setw(8) << medication << endl;
	cout    << "Total charges   $" << setw(8) << totalCharges << endl;
	cout << "******************************\n";



	return 0;
}// End of main function

//***********************************************************
// Definition of function getChoice                         *
// Accepts and returns user's validated menu choice.        *
//***********************************************************
char getChoice()
{
	char letter;        // Holds user's letter choice

	// Get the user's choice
	cin >> 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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.