1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
|
[/code#include <iostream>
#include<string>
using namespace std;
class insurance_category
{
int prdouct_id;
string level_name;
float Annual_benefit;
int Period_of_cover;
bool Cover_inpatient;
float Total_cover_for_cancer;
bool Psychiatric;
bool Maternity;
public:
insurance_category()
{
prdouct_id= 0;
level_name = " ";
Annual_benefit = 0.0;
Period_of_cover = 0;
Cover_inpatient = true;
Total_cover_for_cancer = 0.0;
Psychiatric = true;
Maternity = true;
}
insurance_category(int prdouctid, string levelname, float Annualbenefit, int Period_OfCover, bool Cover_Inpatient, float Totalcoverfor_Cancer, bool psychiatric, bool maternity)
{
prdouct_id= prdouctid;
level_name = levelname;
Annual_benefit = Annualbenefit;
Period_of_cover = Period_OfCover;
Cover_inpatient = Cover_Inpatient;
Total_cover_for_cancer = Totalcoverfor_Cancer;
Psychiatric = psychiatric;
Maternity = maternity;
}
void set()
{
cout << " enter level name\n";
cin >> level_name;
cout << " enter overall annual benefit\n";
cin >> Annual_benefit;
cout << "enter period of cover\n";
cin >> Period_of_cover;
cout << " cover Inpatient (0-1)\n";
cin >> Cover_inpatient;
cout << " enter Total_cover_for_cancer\n";
cin >> Total_cover_for_cancer;
cout << " enter Psychiatric (0-1)\n";
cin >> Psychiatric;
cout << "enter maternity(0-1)\n";
cin >> Maternity;
}
void print()
{
cout << "\n Prdouct id : " << prdouct_id;
cout << "\n Level Name : " << level_name;
cout << "\n Overall annual benefit : " << Annual_benefit;
cout << "\n Period of cover : " << Period_of_cover;
cout << "\n Cover inpatient : " << Cover_inpatient;
cout << "\n Total cover for cancer : " << Total_cover_for_cancer;
cout << "\n Psychiatric : " << Psychiatric;
cout << "\n Maternity : " << Maternity;
}
int get_pri() { return prdouct_id; }
string get_levname(){ return level_name; }
float get_annualben(){ return Annual_benefit; }
int get_pericover(){ return Period_of_cover; }
bool get_coverinp(){ return Cover_inpatient; }
float get_total_cover(){ return Total_cover_for_cancer; }
bool get_psychi() { return Psychiatric; }
bool get_mater(){ return Maternity; }
}; //end class insurance_category
class customer
{
int id;
string name;
string address;
public:
customer(int id1, string name1, string addres1)
{
id = id1;
name = name1;
address = addres1;
}
customer(){
id = 0;
name = " ";
address = "";
};
void set_id(int i){
id = i;
}
void set_name(string n){
name = n;
}
void set_address(string a){
address = a;
}
int get_id(){ return id; }
string get_name(){ return name; }
string get_address(){ return address; }
void print(){
cout << endl << get_id() << endl << get_name() << endl << get_address() << endl;
}
};
class company: public customer
{
int lincense_num;
int counter;
insurance_category **p;
int x;
public:
company()
{
lincense_num = 0;
counter = 0;
x = 10;
p = new insurance_category*[x];
for (int i = 0; i < 10; i++)
p[i] = NULL;
}
company(int lin_num,int x1, int i1, string n1, string a1) :customer(i1, n1, a1)
{
lincense_num = lin_num;
counter = 0;
x =x1;
p = new insurance_category*[x];
for (int i = 0; i <x; i++)
p[i] = NULL;
}
void set_lincense_num(int l1)
{
lincense_num = l1;
}
void set_insurance_category()
{
if (counter < x){
p[counter] = new insurance_category();
p[counter]->set();
counter++;
}
else cout << "You may not add something \n";
}
void delet(int z)
{
/*delete p[z];
p[z] = NULL;*/
for(int i=0;i<x;i++)
{if(p[i]->get_pri()==z)
delete p[i];
p[i-1]=NULL;
}
}
void modify(int ob_modify)
{
p[ob_modify]->set();
for (int i = 0; i<x; i++)
{
if (p[i]->get_pri() == ob_modify)
p[i]->set();
}
}
int get_lincense_num()
{
return lincense_num;
}
void print()
{
cout << lincense_num << endl;
print();
for (int i = 0; i < counter; i++){
if (p[i] != NULL)
p[i]->print();
}
}
};
class individual :public customer
{
int age;
int phone_number;
public:
individual()
{
age = 0;
phone_number = 0;
}
individual(string name1, int ag1, int phone1, int id1, string addres1) :customer(id1, name1, addres1)
{
age = ag1;
phone_number = phone1;
}
void set_age(int ag1){
age = ag1;
}
void set_phone_number(int phone1){
phone_number = phone1;
}
int get_age(){
return age;
}
int get_phone_number(){
return phone_number;
}
void print()
{
cout << endl <<"id:"<< customer::get_id() << endl << "name: "<< customer::get_name() << endl <<"address:" <<customer::get_address() << endl <<"age:"<< get_age() << endl << "phone number:"<<get_phone_number() << endl;
}};
int main()
{
//customer
int id;
string name, address;
//indi
int Age, phone;
//company
int lincen;
//insura
int prdouct_id;
string level_name;
float Annual_benefit;
int Period_of_cover;
bool Cover_inpatient;
float Total_cover_for_cancer;
bool Psychiatric;
bool Maternity;
int k,c;
char x,x1;
insurance_category Print;
cout << "***** WELOCME TO OUR PROGRAM ***** ";
do
{
int Customer;
cout << "\nPlease choice your Customer : \n";
cout << "1- Individual :\n";
cout << "2- Company :\n";
cin >> Customer;
if(Customer==1)
{
cout << "\nYour choice is Individual :\n ";
cout << "\n Please enter your ID : ";
cin >> id;
cout << "\n Please enter your Name : ";
cin >> name;
cout << "\n Please enter your Address : ";
cin >> address;
cout << " \n Please enter your Age : \n";
cin >> Age;
cout << "\n Please enter your Phone Number : \n ";
cin >> phone;
individual ob1(name,Age,phone,id,address);
ob1.print();
}
if (Customer==2)
{
cout << "\n Your choice is Company : \n ";
cout << "\n Please enter your ID : ";
cin >> id;
cout << "\n Please enter your Name : ";
cin >> name;
cout << "\n Please enter your Address : ";
cin >> address;
cout << "\n Please enter your Lincense Num : \n";
cin >> lincen;
cout << "\n Please enter number of array : \n";
cin >> k;
company ob2(lincen,k,id,name,address);
ob2.print();
do
{
cout << "\nPlease chose what you want \n";
cout << "\n1- creat new insurance :\n ";
cout << "\n2- modify any insurance :\n ";
cout << "\n3- Delete any insurance : \n";
cout << "\n4- Print all Data insurance :\n ";
cin >> c;
switch(c)
{
case 1:
cout << "\n Insurance Data \n ";
cout << " enter product id\n";
cin >> prdouct_id;
cout << " enter level name\n";
cin >> level_name;
cout << " enter overall annual benefit\n";
cin >> Annual_benefit;
cout << "enter period of cover\n";
cin >> Period_of_cover;
cout << " cover Inpatient enter 1 if you want, 0 if you not : \n";
cin >> Cover_inpatient;
cout << " enter Total_cover_for_cancer\n";
cin >> Total_cover_for_cancer;
cout << " enter Psychiatric enter 1 if you want, 0 if you not : \n";
cin >> Psychiatric;
cout << "enter maternity enter 1 if you want, 0 if you not : \n";
cin >> Maternity;
break;
case 2:
cout << "\n Do you want Modify ? enter Y/y ... if you don't want enter N/n : ";
char m;
cin >> m;
if ((m == 'y'||m=='Y') && (m!='N'|| m!='n'))
{
cout << "\nEnter number of culomn you want to modify it : ";
int c;
cin >> c;
ob2.modify(c);
}
else cout << "\nthere is no modify";
break;
case 3:
cout << "\nenter number of culomn in array you to delete it :";
int d1;
cin >> d1;
ob2.delet(d1);
break;
case 4:
cout << "Print All Data insurance : ";
Print.print();
}
cout << "\n if Do you want see list agin enter Y/y ... if you don't want enter N/n : ";
cin >> x;
}
while((x == 'y'|| x == 'Y') && (x!='N'|| x!='n'));
}
cout << "\n If you want creat new customer enter Y/y ... if you don't want enter N/n : ";
cin >> x1;
}
while((x1 == 'y'|| x1 == 'Y') && (x1!='N'|| x1!='n'));
return 0;
}
[code]
|