Skip to main content
Create a class called scheme with scheme_id, scheme_name,outgoing_rate, and message_charge. Derive customer class form scheme and include cust_id, name and mobile_no data.Define necessary functions to read and display data. Create a menu driven program to read call and message information for a customer and display the detail bill.
CODING:
#include<iostream.h>
#include<conio.h>
class scheme
{
protected:
int id,out,msg;
char name[20];
};
class customer:public scheme
{
int cu_id;
char cu_name[10],no[10];
public:
void cu_info()
{
cout<<"CUSTOMER ID    :";
cin>>cu_id;
cout<<"CUSTOMER NAME  :";
cin>>cu_name;
cout<<"PHONE NUMBER   :";
cin>>no;
cout<<"OUTGOING CALL  :";
cin>>out;
cout<<"OUTGOING MSG   :";
cin>>msg;
}
void set_scheme(int n)
{
id=n;
if(id==1)
{
 out=out*2;
 msg=msg*0.6;
}
else if(id==2)
{
 out=out*2.2;
 msg=msg*0.7;
}
else if(id==3)
{
 out=out*2.4;
 msg=msg*0.7;
}
cout<<"SCHEME NAME        :";
cin>>name;
}
void disp_bill()
{
cout<<"\nY O U R  B I L L";
cout<<"\nCUSTOMER ID   :"<<cu_id;
cout<<"\nCUSTOMER NAME :"<<cu_name;
cout<<"\nPHONE NUMBER  :"<<no;
cout<<"\nSCHEME ID     :"<<id;
cout<<"\nSCHEME NAME   :"<<name;
cout<<"\nOUTGOING RATE :"<<out<<"Rs.";
cout<<"\nMESSAGE CHARGE:"<<msg<<"Rs.";
}
};
void main()
{
int ch;
customer obj1;
clrscr();
obj1.cu_info();
first:
cout<<"S.ID  SIM              SCHEME ";
cout<<"\n1     JIO   ->CALL:2Rs.   MSG:0.6Rs.";
cout<<"\n2     AIRTEL->CALL:2.2Rs. MSG:0.7Rs.";
cout<<"\n3     IDEA  ->CALL:2.4Rs. MSG:0.7Rs.\nEnter the Scheme ID:";
cin>>ch;
if(ch<4)
{
 obj1.set_scheme(ch);
 obj1.disp_bill();
}
else
{
cout<<"Enter Valid Scheme ID.\n";
goto first;
}
getch();
}

Comments