after i was able to get my other program to run with everyone's input I decided to try a different one to get a better understanding of function programming. I current objective is to write a program that computes and displays the charges for a patient’s hospital stay.
The program design is:
First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient, the following data should be entered:
• The number of days spent in the hospital
• The daily rate
• Hospital medication charges
• Charges for hospital services (lab tests, etc.)
The program should ask for the following data if the patient was an out-patient:
• Charges for hospital services (lab tests, etc.)
• Hospital medication charges The program should use two overloaded functions to calculate the total charges.
One of the functions should accept arguments for the in-patient data, while the other function accepts arguments for out-patient information. Both functions should return the total charges. Input Validation: Do not accept negative numbers for any data.
The issues I am having when I attempt to complie state:
too few arguments to function `double getInPatient(int, double, double, double)'
too few arguments to function `double getOutPatient(double, double)'
it also states varibles that are declared as undeclared.
ambiguates old declaration `double getInPatient(int, double, double, double)'
ambiguates old declaration `double getOutPatient(double, double)'
I do believe if I can get past the too few arguments to function issues the rest might be taken of. Thank you in advance to all who come to my aid.
[code]
// *****************************************************************************
// Program: Overloaded Hospital
// Purpose: program that computes and displays the charges for a patient's
// hospital stay. ask if the patient was admitted as an in-patient or
// an out-patient. If the patient was an in-patient, the following data
// should be entered: The number of days spent in the hospital, The
// daily rate, Hospital medication charges, and Charges for hospital
// services (lab tests, etc.) ask for the following data if the patient
// was an out-patient: Charges for hospital services (lab tests, etc.)
// and Hospital medication charges. Input Validation: Do not accept
// negative numbers for any data.
// *****************************************************************************
cout << "Is the patient an In-patient or Out-patient: ";
cin >> patientStatus;
while (patientStatus !='I' || patientStatus !='i'
|| (patientStatus != 'O' || patientStatus != 'o'))
{
cout << "ERROR! Please enter one of the following (I,i O, o): ";
cin >> patientStatus;
}
Instead of using the or operator, use and. Ironically, I can't logically figure out why it works, but the and operator definitely allows the program correctly, I tried it to make sure.