this is meant to be a program with 4 functions msin, getPatientType and two patientCharges. its an overloaded function thing. anyway my professor wont explain what im doing wrong so please help
#include<iostream>
#include<iomanip>
usingnamespace std;
//define general variables
void getChoice(char);
double getCharges(double, int, double, double);
double getCharges(double, double);
int main()
{
//define variables for this function
char patient;
int days;
double rate,
medicine,
hospital;
//ask the user for in patient or out patient
cout << fixed << showpoint << setprecision(2);
cout << "Is this for an In-Patient or Out-Patient?" << endl;
cout << "Enter I for in-patient and O for out-patient" << endl;
getChoice(patient);
//check input
// EDIT used assignment operator (=) instead of conditional (==)
if (!(patient == 'i' || patient == 'I' || patient == 'o' || patient == 'O') )
{
// EDIT did not put '<<' in between string ("PLease enter a(n) I or a O") and endl
cout << "PLease enter a(n) I or a O" << endl;
getChoice(patient);
}
if (patient == 'i' || patient == 'I')
{
//if in patient ask for charges
cout << "How many days did you spend in the hospital?" << endl;
cin >> days;
cout << "What was the daily rate? " << endl;
cin >> rate;
cout << "Medication charges?" << endl;
cin >> medicine;
cout << "Lab fees and other service charges? ";
cin >> hospital;
cout << "The total charges are " << getCharges(rate, days, medicine, hospital) << "." << endl;
}
if (patient == 'o' || patient == 'O')
{
//get charges if out patient
// EDIT Missing switch(patient) ?
case'O':
case'o': cout << "Lab fees and other service charges? " << endl;
cin >> hospital;
cout << "Medication charges? " << endl;
cin >> medicine;
cout << "The total charges are " << getCharges(hospital, medicine) << "." << endl;
}
return 0;
}
//define variables for the math
double charges,
total;
// EDIT not sure what is suppossed to go here. Overloaded getCharges? Need an identifier
{
//do the math
double total = (rate * days) + hospital + medicine;
}
// EDIT again, not sure what is suppossed to go here. Overloaded getCharges? Need an identifier
{
//good golly more math
double charges = hospital + medicine;
}
//display info
// EDIT what should go here? A print function?
{
cout << fixed << showpoint << setprecision(2);
cout << "Medication and service charges" << charges << endl;
cout << "Total hospital charges" << total << endl;
}