Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

just finished it and 1st time posting something here.

‎#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
class Customer
{
friend int Bill(int);
private:
string Name;
int Customer_Id,Spending;

public:

Customer()
{
Name="No name";
Customer_Id=0;
Spending=0;
}
Customer(string n,int i,int s)
{
Name=n;
Customer_Id=i;
Spending=s;
}
void setter()
{
cout"Enter Name Of Customer : ";
cin>>Name;
cout"Enter Id Of Customer : ";
cin>>Customer_Id;
cout"Enter Total Spending Of Customer : ";
cin>>Spending;
}
void getter()
{
cout"Name : "Nameendl;
cout"ID : "Customer_Idendl;
cout"Spending : "Spendingendl;
cout"Total Bill : "Bill(Spending)endlendlendlendl;
}
};

int Bill(int s)
{
int Discount,Tax;
if(s<5000)
{
cout"1nd condation"endl;
Discount=s*1/100;
Tax=s*5/100;
s=s+Tax;
s=s-Discount;

}
if(s>5000 && s<10000)
{
cout"2nd condation"endl;
Discount=s*2/100;
Tax=s*10/100;
s=s+Tax;
s=s-Discount;
}
if(s>10000)
{
cout"3nd condation";
Discount=s*3/100;
Tax=s*15/100;
s=s+Tax;
s=s-Discount;
}
return s;


}
int main(int argc, char *argv[])
{
Customer *obj1;
obj1=new Customer;
Customer *obj2;
obj2=new Customer("Adnan",223,8550);

Customer *obj3;

obj3=new Customer;
cout"Bill detail for customer 1,initialized with default constructor"endl;
obj1->getter();

cout"Bill detail for customer 2,initialized with Parameterized constructor"endl;
obj2->getter();

obj3->setter();
coutendlendl"Bill detail for customer 3,inputs entered by user"endl;
obj3->getter();
system("PAUSE");
return EXIT_SUCCESS;
}

 

Views: 530

Replies to This Discussion

ONLY 18 errors.... "Thanks" !

working here for me on dev c++ dear can upload screen shots as well

here is it with working on dev c++ dears code may change somethings when paste here directly... just checked it ... didn't know before coz this is my first discussion here

Attachments:

@aadil Sharif too good buddy... and thankx for uploading... keep it up dude! may god be blessed...

Wrong solution, no friend function calll....!!!!

100% correct solution..but it include some difficult concepts..well working fine..

check the out as compare to problem statement, feel the difference, feel the errors...

http://www.cplusplus.com/forum/beginner/72934/

check this link plz here is ideas.

RSS

Looking For Something? Search Below

Latest Activity

+ ! ! ! ❣ Sanam ❣ !+ replied to ASIM!!'s discussion Faisla
2 minutes ago
ASIM!! commented on ASIM!!'s photo
17 minutes ago
ASIM!! replied to ASIM!!'s discussion Faisla
31 minutes ago
+ ! ! ! ❣ Sanam ❣ !+ replied to ASIM!!'s discussion Faisla
54 minutes ago
ASIM!! replied to ASIM!!'s discussion Faisla
57 minutes ago
+ ! ! ! ❣ Sanam ❣ !+ replied to ASIM!!'s discussion Faisla
1 hour ago
ASIM!! replied to ASIM!!'s discussion Faisla
2 hours ago
+ ! ! ! ❣ Sanam ❣ !+ replied to ASIM!!'s discussion Faisla
2 hours ago

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service