-->
当前位置:首页 > 题库

PROGRAMMING:My Alipay and Yu Ebao

Luz5年前 (2021-05-10)题库389
Alipay AliPay and balance treasure AliFund are good brothers, they come from the same parent class Account.
The known class Account is the virtual base class of Alipay AliPay and balance treasure AliFund, including two protected member data:
long ID;// account number
string name;// user name
Alipay AliPay is a protected class derived from Account, including two new protected member data:
double amount;// Amount in Alipay account
int out-limit;// The transfer limit of Alipay can not exceed the limit of the account.
//When the transfer request exceeds the above limit, the maximum allowable amount will be automatically transferred out
Yu'ebao alifund is a protection derived class of account class, including three newly added protected member data
double amount;// Amount in yu'ebao account
double rate;// Annual interest rate of funds in yu'ebao account
int in-limit;// The transfer limit of yu'ebao shall not be less than the limit when the funds are transferred to yu'ebao
//When the transfer in fund is less than the minimum amount, the transfer in operation will be automatically ignored and the fund will be returned
In order to achieve the functions of fund collection and transfer between Alipay account and balance account, now create a Taobao account My_ based on AliPay and AliFund. Ali, including the following new data members:
bool auto_ collect_ flag;// Automatic fund collection flag
int threshold;// Automatic fund collection threshold
/ * * / if the automatic fund collection mark is true, when the amount of Alipay account exceeds the automatic collection threshold of threshold, part of the funds that exceed and comply with the Alipay account transfer limit and the balance of the funds transferred to the lower limit will be automatically transferred to the balance treasure * / * /
Increasing the appropriate member function can achieve the transfer of funds between Alipay account and the balance account, and the automatic collection function of Alipay account to the balance account.
Generate the above types and write the main function, according to the input initial account information, establish the user object, according to the user's account operation information, output the user's final fund information.
The test input contains a test case:
First, the behavior of the initial account information, the first data is the account number, the second string is the user name, the third data is the initial amount of Alipay, the fourth data is the Alipay transfer limit, the fifth data is the initial amount of the balance treasure, the sixth data is the annual interest rate of the balance treasure fund, seventh data is the lower limit of the balance treasure transfer, eighth data is the automatic fund collection sign. The character Y represents to set automatic fund collection, and the character n represents not to set automatic fund collection. If automatic fund collection is set, the ninth data is the threshold of automatic fund collection. Otherwise, the ninth data does not exist.
Each row then represents an operation of the user's capital account. The first number represents the account type currently operated. 1 represents the Alipay account, the 2 represents the balance account, second figures represent the specific operation, 1 represents the increase in account funds, 2 represents the decrease in the account amount, the 3 generation represents the transfer of funds between Alipay and the balance treasure, and third figures represent the amount of operation.
It ends when 0 is last entered.
Note: when the automatic collection of funds is genuine, Alipay accounts will automatically trigger automatic collection of funds every time they increase.
Input example:
100001 Zhangsan 1000 30000 50000 0.047 5000 Y 3000
1 1 1500
1 2 500
1 3 500
1 1 7000
2 3 500
0 0 0
Output example:
Account for Zhangsan
Total: 59000
AliPay: 3500
AliFund: 55500 with rate 4.7%






answer:If there is no answer, please comment