We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

# CS201 Assignment # 05 Complete Solution spring 2012 with setfill() and setw() including main() Final Solution

#include <iostream>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <conio.h>
using namespace std;

class Customer
{
private:
string Name;
int CustomerId;
int Spending;
int tax;
int discount;
int totalbill;
public:
void setName(string);
int setCustomerId(int);
int setSpending(int);
int getName(string);
int getCustomerId(int);
int getSpending(int);
void display()
{
cout"Customer Name : "Nameendlendl"ID : "CustomerIdendlendl"Spending : "Spendingendlendl;
}

Customer();
Customer(string, int, int);
friend ostream & operator(ostream &, Customer&);
friend istream & operator>>(istream &, Customer&);
};

Customer::Customer()
{
Name="No Name";
CustomerId=0;
Spending=0;
}
Customer::Customer(string s, int i, int j)
{
Name=s;
CustomerId=i;
Spending=j;
}
istream & operator>>(istream & input, Customer &c)
{
cout"Enter the name of customer : ";
input>>c.Name;
cout"Enter the customer-id : ";
input>>c.CustomerId;
cout"Enter the Spending : ";
input>>c.Spending;
return input;
}
ostream & operator(ostream & output, Customer &c)
{
for(int i=0;i<55;i++)
{
if(i==25)
{

output"****************************Customer Bill Information***************************";
}

}
outputendl;
output"Name " ;
for(int a=0;a<21;a++)
{
if(a==20)
{
output c.Name endl;
}

else
{
outputsetfill('*')setw(15);
}
}
output"ID " ;
for(int a=0;a<23;a++)
{
if(a==22)
{
outputc.CustomerIdendl;
}

else
{
outputsetfill('*')setw(15);
}
}
output"Spending ";
for(int a=0;a<19;a++)
{
if(a==18)
{
outputc.Spendingendl;
}

else
{
outputsetfill('*')setw(15);
}
}

if(c.Spending<=5000)
{
c.tax=(c.Spending*5)/100;
c.discount=(c.Spending*1)/100;
c.totalbill=c.Spending+c.tax-c.discount;
output"Tax ";
for(int a=0;a<27;a++)
{
if(a==26)
{
outputc.taxendl"Discount ";
for(int a=0;a<19;a++)
{
if(a==18)
{
outputc.discountendl"Total Bill ";
for(int a=0;a<17;a++)
{
if(a==16)
{
outputc.totalbillendl;
}

else
{
outputsetfill('*')setw(15);
}
}
}
else
{
outputsetfill('*')setw(15);
}
}
}
else
{
outputsetfill('*')setw(15);
}
}

}
else if(c.Spending>5000 & c.Spending<10000)
{
c.tax=(c.Spending*10)/100;
c.discount=(c.Spending*2)/100;
c.totalbill=c.Spending+c.tax-c.discount;
output"Tax ";
for(int a=0;a<27;a++)
{
if(a==26)
{
outputc.taxendl"Discount ";
for(int a=0;a<19;a++)
{
if(a==18)
{
outputc.discountendl"Total Bill ";
for(int a=0;a<17;a++)
{
if(a==16)
{
outputc.totalbillendl;
}
else
{
outputsetfill('*')setw(15);
}
}
}

else
{
outputsetfill('*')setw(15);
}
}
}
else
{
outputsetfill('*')setw(15);
}
}
}
else if(c.Spending>10000)
{
c.tax=(c.Spending*15)/100;
c.discount=(c.Spending*3)/100;
c.totalbill=c.Spending+c.tax-c.discount;
output"Tax ";
for(int a=0;a<27;a++)
{
if(a==26)
{
outputc.taxendl"Discount ";
for(int a=0;a<19;a++)
{
if(a==18)
{
outputc.discountendl"Total Bill ";
for(int a=0;a<17;a++)
{
if(a==16)
{
outputc.totalbillendl;
}
else
{
outputsetfill('*')setw(15);
}
}
}
else
{
outputsetfill('*')setw(15);
}
}
}
else
{
outputsetfill('*')setw(15);
}
}
}
return output;
}
main()
{
Customer obj;
cin>>obj;
coutobj;
system("pause");
}

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

Views: 871

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

### Replies to This Discussion

EnjOY it All

Attachments:

wrong solution

jo teak hae wo aap upload kar do na sumaira

sumaira ji ap her jaga pe wrong wrong kehti ja rhai ahin, lekin sae kia hai wo to ap bhi nahi bata rahi...huh

thanxxxxxxxxx

js ko assignment chahiy mail me!

yE friend function kesy use karna hy ? ye sign kiya hy ??? & plzzzzz bta dein ://

## Latest Activity

1 minute ago
1 minute ago
zohaib iftikhar posted discussions
2 minutes ago
+ ! ! ! ! ! ! 11 updated their profile
3 minutes ago
3 minutes ago
26 minutes ago
42 minutes ago
49 minutes ago
49 minutes ago
49 minutes ago
50 minutes ago

1

2

3