assignmnt on classes

it is a question on classes in order to get total charge of syrgery done medication taken, daily rate fee of hospital and then at last calculating the total charge of a patient.
i cannot complete the main program. the total charge is not being displayed. if i could get the correct code for the main program.

// account class//

class patientaccount{
float TotalCharge,daily_rate;
int Days;

public:
patientaccount();
void rate(float);
void UpdateDay();
void AddCharge(float);
float DisplayCharge();

};


// pharmacy.h//
class surgery:public patientaccount
{
float medication1(panadol),medication2(piriton),medication3(maxilase),medication4(novagesic-flu),medication5(zecid);

public:
pharmacy();
void updatepatient(int);
};


// class surgery //

class surgery:public patientaccount
{
float Surgery1,Surgery2,Surgery3,Surgery4,Surgery5;

public:
surgery();
void updatepatient(int);
};
// account cpp file
#include <iostream>
using namespace std;
#include "Account.h"
patientaccount::patientaccount()
{
TotalCharge=0;
daily_rate=0;
Days=0;
}

void patientaccount::rate(float a){
daily_rate=a;
}

void patientaccount::UpdateDay(){
Days+=1;
}

void patientaccount::AddCharge(float b){
TotalCharge+=b;
}

float patientaccount::DisplayCharge(){
return TotalCharge;
}

// pharmacy cpp file

#include "pharmacy.h"
#include <iostream>
using namespace std;
{

pharmacy::pharmacy(){
medication1(panadol)=100;//Values are random can be change
medication2(piriton)=200;
medication3(maxilase)=300;
medication4(novagesic-flu)=400;
medication5(zecid)=500;
}

void pharmacy::updatepatient(int a){
if(a=1)
AddCharge(medication1(panadol));
else if(a=2)
AddCharge(medication2(piriton));
else if(a=3)
AddCharge(medication3(maxilase));
else if(a=4)
AddCharge(medication4(novagesic-flu));
else if(a=5)
AddCharge(medication5(zecid));
}
}


// surgery cpp file

#include "surgery.h"
#include <iostream>
using namespace std;
{

surgery::surgery(){
Surgery1=15000;//Values are random can be change
Surgery2=20000;
Surgery3=25000;
Surgery4=35000;
Surgery5=50000;
}

void surgery::updatepatient(int a){
if(a=1)
AddCharge(Surgery1);
else if(a=2)
AddCharge(Surgery2);
else if(a=3)
AddCharge(Surgery3);
else if(a=4)
AddCharge(Surgery4);
else if(a=5)
AddCharge(Surgery5);
}
}

// main file.cpp//

#include <iostream>

using namespace std;

int main()
{
float surgery, medication,Total_Charge;
int daily_rate, Days;
cout<<"Please choose a surgery from the given list below"<<endl;
cout<<"1. \t Surgery1"<<endl;
cout<<"2. \t Surgery2 "<<endl;
cout<<"3. \t Surgery2 "<<endl;
cout<<"4. \t Surgery2"<<endl;
cin>>surgery;
switch(surgery)
{
case(1):
{
cout<<" surgery cost is 15000 "<<endl;
return 0;

}
case(2):
{
cout<<" surgery cost is 20000 "<<endl;
return 0;
}
case(3):
{
cout<<" surgery cost is 25000 "<<endl;
return 0;
}
case(4):
{
cout<< "surgery cost is 35000 "<<endl;
return 0;
}
case(5):
{
cout<< "surgery cost is 50000 "<<endl;
return 0;
}

}

cout<<"medication you want to take: Please choose from the given list:"<<endl;
cout<<"1. \t medication1(panadol)"<<endl;
cout<<"2. \t medication2(piriton) "<<endl;
cout<<"3. \t medication3(maxilase)"<<endl;
cout<<"4. \t medication4(novagesic-flu)"<<endl;
cout<<"5. \t medication5(zecid)"<<endl;
cin>>medication;
switch(medication)
{
case(1):
{
cout<< "medication1(panadol) is 100" <<endl;
}
case(2):
{
cout<< "medication2(piriton)=200" <<endl;
}
case(3):
{
cout<< "medication3(maxilase)=300" <<endl;
}
case(4)
{
cout<< "medication4(novagesic-flu)=400<<endl;
}
case(5):
{
cout<<" medication5(zecid)=500 " <<endl;
}
}


cout<<"therefore cost of surgery and medicines make upto: " <<endl;
cout<<"adding to that the daily rate, all make up to: " <<endl;
cout<< "the patient is checked out " <<endl;

Total_Charge=(days*(daily_rate))+surgery price+(list of medication total price)

cout<< "thus making all the total charge is : " << total_Charge<<endl;

}





Topic archived. No new replies allowed.