fixed.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:

C#编程

开发平台:

Visual C++

  1. //fixed.cpp
  2. #include "fixed.h"
  3. #include <iostream.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. Fixed::Fixed(unsigned accNo, float balan)
  7.   :Savings(accNo, balan)
  8. {
  9.   int interval;
  10.   cout <<"please select a number of fixed year(1, 3, 5):n";
  11. cin >>interval;
  12. switch(interval){
  13. case 1: rate=1.05f;  break;
  14. case 3: rate=1.08f;  break;
  15. case 5: rate=1.1f;  break;
  16. default: rate=1.08f;
  17. }
  18. _strdate(validDay);
  19.   char strYear[3];
  20. strcpy(strYear, &validDay[6]);
  21. int intYear = atoi(strYear)+interval;
  22. _itoa(intYear,strYear,10);
  23. strcpy(&validDay[6], strYear);
  24. }
  25. bool Fixed::VerifyDate() const
  26. {
  27.   char strToday[9];
  28. _strdate(strToday);
  29. return strcmp(strToday, validDay) >= 0;
  30. }
  31. void Fixed::Withdrawal(float amount)
  32. {
  33.   if(balance){
  34.   balance *= (VerifyDate() ? rate : 1.01f);
  35.   Display();
  36.   balance=0;
  37. }
  38. }