OOCP2_7

//BCA Support //www.bcasupport.xyz #include <iostream.h> #include <conio.h> class scheme { protected: int id; float outrate,msgcharge; char name[10]; public: void getdata() { cout<<"\n->Scheme Details-"; cout<<"\nEnter Scheme ID : "; cin>>id; cout<<"Enter Scheme name : "; cin>>name; cout<<"Enter call outgoing rate per minute : Rs. "; cin>>outrate; cout<<"Enter message charge per message : Rs. "; cin>>msgcharge; } }; class customer: public scheme { int id,calltime,msgcount; char name[20],phone[10]; float callbill,msgbill,totalbill; public: customer() { cout<<"\n-> Customer Details-"; cout<<"\nEnter Customer ID : "; cin>>id; cout<<"Enter Customer name : "; cin>>name; cout<<"Enter Phone number : "; cin>>phone; getdata(); cout<<"\n-> Usage Details-\nTotal call time (mins) : "; cin>>calltime; cout<<"Total messages : "; cin>>msgcount; } void print() { callbill=outrate*calltime; msgbill=msgcharge*msgcount; totalbill=callbill+msgbill; cout<<"\n\n-> Billing Details-\n"; cout<<"1. Call Bill : Rs. "<<callbill; cout<<"\n2. Message Bill : Rs. "<<msgbill; cout<<"\nTotal Bill : Rs. "<<totalbill; } }; int main() { clrscr(); customer c1; c1.print(); getch(); return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.