#include<conio.h>
#include <stdlib.h>
#include<ctype.h>
using namespace std;
class Customer{
string name;
int customerId;
int spending;
float totalBill;
public:
void display();
void setName(string name);
void setCustomerId(int i);
void setSpending(int i);
string getName();
int getCustomerId();
int getSpending();
float getTotalBill();
friend float tBill( Customer *) ;
Customer();
Customer(string, int , int);
~Customer ();
};
Customer::Customer(){
name= "No name";
customerId = 0;
spending = 0;
}
Customer::Customer(string thename, int thecustomerId , int thespending){
name = thename;
customerId = thecustomerId;
spending = thespending;
}
Customer::~Customer(){
}
void Customer::display(){
cout<<"Customer Name : "<<getName()<<endl;
cout<<"ID : "<<getCustomerId()<<endl;
cout<<"Spending : "<<getSpending()<<endl;
cout<<"Total Bill : "<<getTotalBill();
}
void Customer::setName(string n){
name = n ;
}
void Customer::setCustomerId(int i){
customerId = i;
}
void Customer::setSpending(int i){
spending = i;
}
string Customer::getName(){
return name;
}
int Customer::getCustomerId(){
return customerId;
}
int Customer::getSpending(){
return spending;
}
float Customer::getTotalBill(){
return totalBill;
}
main()
{
Customer *c1 = new Customer();
Customer *c2 = new Customer("AIFA ZARAK",777,9500);
Customer *c3 = new Customer;
cout<<"Bill Detail for customer 1, initialized with default constructor"<<endl;
tBill(c1);
c1->display();
cout<<endl<<endl<<"Bill detail for customer 2, initialized with parameterized constructor"<<endl;
tBill(c2);
c2->display();
cout<<endl;
string name;
int id, spend;
cout<<endl<<endl<<"Enter name of customer 3 :";
cin>>name;
cout<<"Enter ID of customer 3 :";
cin>>id;
cout<<"Enter total spending of customer 3 :";
cin>>spend;
cout<<endl;
c3->setName(name);
c3->setCustomerId(id);
c3->setSpending(spend);
tBill(c3);
c3->display();
getche();
}
float tBill( Customer *c){
if(c->spending<5000){
float a,b;
a=(c->spending*5)/100;
b=(c->spending*1)/100;
c->totalBill=c->spending+a-b;
}
if(c->spending>5000 && c->spending<10000){
float a,b;
a=(c->spending*10)/100;
b=(c->spending*2)/100;
c->totalBill=c->spending+a-b;
}
if(c->spending>10000){
float a,b;
a=(c->spending*15)/100;
b=(c->spending*3)/100;
c->totalBill=c->spending+a-b;
}
}
On Fri, Jun 15, 2012 at 5:07 PM, KING ABDullah <m.abdullah.n@gmail.com> wrote:
help help mujay 201 ki Assignment chaheay plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
--
ْقرۤآن و سنت کی دعوت لے کر اُٹھو اور پوری دنیا پر چھا جاو۔۔(سید مودودی)
--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US
--
Study Stuff For Finalterm Exam
~WALKING ALONE IS NOT DIFFICULT~BUT WHEN WE HAVE WALKED A MILE WITH SOMEONE THEN COMING BACK ALONE IS SO DIFFICULT~
~WALKING ALONE IS NOT DIFFICULT~BUT WHEN WE HAVE WALKED A MILE WITH SOMEONE THEN COMING BACK ALONE IS SO DIFFICULT~
--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com
Group Rules Vuhelp4u
Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.
http://groups.google.com/group/vuhelp_pk?hl=en_US
No comments:
Post a Comment