📄 dayhours.cpp
字号:
//Dayhours.cpp
#include<iostream.h>
#include<stdlib.h>
#include<time.h>
#include"Counter.h"
#include"Np.h"
#include"Dayhours.h"
Dayhours::Dayhours(int t,double d,double a):Np(t,d)
{
counting(a);
}
double Dayhours::counting(double a)
{
actualityexpense=a;
finalexpense=dailydiscount*actualityexpense;
return finalexpense;
}
void Dayhours::upgrade(double f)
{
f=finalexpense;
int g;
char c;
int a;
srand(time(0));
a=rand()%100000;
if(f>=700&&f<1200) g=1;
else if(f>=1200&&f<1800) g=2;
else if(f>1800) g=3;
switch(g)
{case 1:cout<<"The Expenditure is over 700,"<<endl
<<"Would you please to aply for a Silver Member card:"<<endl
<<"Yes(y) or No(n)?"<<endl;
cin>>c;
switch(c)
{case'y':cout<<"Congratuations!You have been our Silver Member!"<<endl;
cout<<"your new Silver Cardnumber is:"<<"3333"<<a<<endl;
break;
case'n':cout<<"Thank you!"<<endl;break;
} break;
case 2:cout<<"The Expenditure is over 1200,"<<endl
<<"Would you please to aply for a Gold Member card:"<<endl
<<"Yes(y) or No(n)?"<<endl;
cin>>c;
switch(c)
{case'y':cout<<"Congratuations!You have been our Gold Member!"<<endl;
cout<<"your new Gold Cardnumber is:"<<"9999"<<a<<endl;
break;
case'n':cout<<"Thank you!"<<endl;break;
} break;
case 3:cout<<"The Expenditure is over 700,"<<endl
<<"Would you please to aply for a Diamond Member card:"<<endl
<<"Yes(y) or No(n)?"<<endl;
cin>>c;
switch(c)
{case'y':cout<<"Congratuations!You have been our Diamond Member!"<<endl;
cout<<"your new Diamond Cardnumber is:"<<"8888"<<a<<endl;
break;
case'n':cout<<"Thank you!"<<endl;break;
} break;
}
}
void Dayhours::print()const
{
Np::print();
cout<<"actualityexpense is:"<<actualityexpense<<endl;
cout<<"finalexpense is:"<<finalexpense<<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -