=====================================
=====================================
#include<iostream>
using namespace std;
class customer
{
string name;
string no;
string adr;
string id;
int n;
int p[100];
public:
void get()
{
cin>>name;
cin>>no;
cin>>adr;
cin>>id;
cin>>n;
int i;
for(i=0;i<n;i++)
cin>>p[i];
}
int calc_Total()
{
int sum,i;
for(i=0;i<n;i++)
sum=sum+p[i];
return sum;
}
};
class preferred_Customer
{
string name;
string no;
string adr;
string id;
int n;
int p[100];
public:
void get()
{
cin>>name;
cin>>no;
cin>>adr;
cin>>id;
cin>>n;
int i;
for(i=0;i<n;i++)
cin>>p[i];
}
int calc_Total()
{
int sum,i;
for(i=0;i<n;i++)
{sum=sum+p[i];
if(sum>=5000 && sum<10000)
sum=sum-p[i]/100;
else if(sum>=10000 && sum<15000)
sum=sum-p[i]/50;
else if(sum>=15000 && sum<20000)
sum=sum-p[i]*3/100;
else if(sum>=20000)
sum=sum-p[i]/25;
}
return sum;
}
};
=====================================
#include<iostream>
using namespace std;
class customer
{
string name;
string no;
string adr;
string id;
int n;
int p[100];
public:
void get()
{
cin>>name;
cin>>no;
cin>>adr;
cin>>id;
cin>>n;
int i;
for(i=0;i<n;i++)
cin>>p[i];
}
int calc_Total()
{
int sum,i;
for(i=0;i<n;i++)
sum=sum+p[i];
return sum;
}
};
class preferred_Customer
{
string name;
string no;
string adr;
string id;
int n;
int p[100];
public:
void get()
{
cin>>name;
cin>>no;
cin>>adr;
cin>>id;
cin>>n;
int i;
for(i=0;i<n;i++)
cin>>p[i];
}
int calc_Total()
{
int sum,i;
for(i=0;i<n;i++)
{sum=sum+p[i];
if(sum>=5000 && sum<10000)
sum=sum-p[i]/100;
else if(sum>=10000 && sum<15000)
sum=sum-p[i]/50;
else if(sum>=15000 && sum<20000)
sum=sum-p[i]*3/100;
else if(sum>=20000)
sum=sum-p[i]/25;
}
return sum;
}
};
No comments:
Post a Comment