Apr 30, 2012 at 2:20am UTC
I am new to C++ programming. Can anyone help and let me know what I did wrong here? I tried to create three objects by calling the constructor from the header files. The reason I am doing this so I can print the output to the console. But it didn't work I got the below error. Thank you for all advices and help.
error C2228: left of '.printPatientDemographicInformation' must have class/struct/union type
error C2228: left of '.printPatientInsuranceInformation' must have class/struct/union type
error C2228: left of '.printPatientBillingInformation' must have class/struct/union type
Here is my code:
#include <iostream.h>
#include "tstring.h"
#include "PTDemo.h"
#include "PTIns.h"
#include "PTBill.h"
int main( )
{
String medicalRecordNumb;
String fName;
char middleInitialName;
String lName;
String streetAddress1Name;
String streetAddress2Name;
String cityName;
String stateName;
String zip5Name;
String zip4Name;
String homeAreaCodeNumb;
String homePhoneNumb;
char genderName;
int theDOB;
char healthInsuranceCodeNumb;
String policyNumb;
String groupNumb;
String diagnosisNumb;
bool monthlyPaymentStatusCode = false;
double monthlyPaymentDollarAmount;
double chargeAmount;
char monthlyPaymentStatusIn;
String userID = "999999999";
String logIn;
cout << "Enter the user ID number: ";
cin >> logIn;
if (logIn != userID)
{
cerr << "Incorect user ID, please re-enter your user ID" << endl;
cout << "Enter the user ID number: ";
cin >> logIn;
}
else
cerr << "You now begin to enter the below information" << endl;
PatientDemographicInformation userName(String medicalRecordNumb, String fName, char middleInitialName, String lName,
String streetAddress1Name, String streetAddress2Name,String cityName, String stateName,
String zip5Name,String zip4Name,String homeAreaCodeNumb, String homePhoneNumb, char genderName,
int theDOB);
PatientInsuranceInformation userNameIns(String medicalRecordNumb, char healthInsuranceCodeNumb, String policyNumb,
String groupNumb);
PatientBillingInformation userNameBill(String medicalRecordNumb, String diagnosisNumb, bool monthlyPaymentStatusCode,
double monthlyPaymentDollarAmount, double chargeAmount);
do
{
cout << "Enter the patient's medical record number: ";
cin >> medicalRecordNumb;
cout << "Enter the patient's first name: ";
cin >> fName;
cout << "Enter the patient's middle initial: ";
cin >> middleInitialName;
cout << "Enter the patient's last name: ";
cin >> lName;
cout << "Enter the patient's street address (line 1): ";
cin.ignore();
getline(cin, streetAddress1Name);
cout << "Enter the patient's street address (line 2): ";
cin.ignore();
getline(cin, streetAddress2Name);
cout << "Enter the patient's city: ";
cin >> cityName;
cout << "Enter the patient's state: ";
cin >> stateName;
cout << "Enter the patient's five digit zip code: ";
cin >> zip5Name;
cout << "Enter the patient's four digit zip code: ";
cin >> zip4Name;
cout << "Enter the patient's home area code: ";
cin >> homeAreaCodeNumb;
cout << "Enter the patient's home phone number: ";
cin >> homePhoneNumb;
cout << "Enter the patient's gender: ";
cin >> genderName;
cout << "Enter the patient's date of birth(format MMDDYYYY): ";
cin >> theDOB;
cout << "Health Insurance Codes: \n";
cout << " 1 - Blue Cross \n";
cout << " 2 - Medicare \n";
cout << " 3 - Medical Assistance \n";
cout << " 4 - Other \n";
cout << "Enter the patient's health insurance code: ";
cin >> healthInsuranceCodeNumb;
cout << "Enter the patient's policy number: ";
cin >> policyNumb;
cout << "Enter the patient's group number: ";
cin >> groupNumb;
cout << "Enter the patient's diagnosis code: ";
cin >> diagnosisNumb;
double paymentAmount = monthlyPaymentDollarAmount;
cout << "Enter the patient's monthly payment status (Y = Monthly Plan, N= No Monthly Plan): ";
cin >> monthlyPaymentStatusIn;
if (monthlyPaymentStatusIn == 'Y' || monthlyPaymentStatusIn == 'y')
{
monthlyPaymentStatusCode = true;
cout << "Enter monthly payment amount: ";
cin >> monthlyPaymentDollarAmount;
cout << "Enter the patient's charge: ";
cin >> chargeAmount;
}
if (monthlyPaymentStatusIn == 'N' || monthlyPaymentStatusIn == 'n')
{
monthlyPaymentStatusCode = false;
cout << "Enter the patient's charge: ";
cin >> chargeAmount;
cout << "Enter the payment amount: ";
cin >> paymentAmount;
}
cout << endl << endl;
cout << "*************************************************************************************" << endl;
cout << "*************************************************************************************" << endl;
cout << "* *" << endl;
cout << "* ABC'S MEDICAL CENTER *" << endl;
cout << "* Building #7, Room #701F *" << endl;
cout << "* 1333 South Prospect Street *" << endl;
cout << "* Summit, CO 18634-3899 *" << endl;
cout << "* (570)012-3456 *" << endl;
cout << "* *" << endl;
cout << "*************************************************************************************" << endl;
cout << "*************************************************************************************" << endl;
userName.printPatientDemographicInformation();
userNameIns.printPatientInsuranceInformation();
userNameBill.printPatientBillingInformation();
} while (logIn == userID);
return 0;
}
Apr 30, 2012 at 2:42am UTC
The part where you declare your objects is incorrect. It looks like you are declaring function prototypes, but I think you are wanting to call the constructors.