Advertisement
conception

lab7.cpp

Nov 22nd, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. class Bank
  5. {
  6. private:
  7. string myname;
  8. int number;
  9. double changes;
  10. double initialbal;
  11. double endingbal;
  12. public:
  13. Bank(string name=" ", int num=0, double c=0, double ibal=0, double ebal=0)
  14. {
  15. myname = name;
  16. number = num;
  17. changes = c;
  18. initialbal = ibal;
  19. endingbal = ebal;
  20. }
  21. void EnterName();
  22. void ShowName(void );
  23. void EnterNumber();
  24. void ShowNumber(void );
  25. void EnterChanges();
  26. void ShowChanges(void );
  27. void EnternComputeInitialBal(double );
  28. void ComputeEndinglBal(double );
  29. };
  30. void Bank::EnterName()
  31. {
  32. cout<<"Please enter your Account Name: ";
  33. getline(cin, myname);
  34. }
  35. void Bank:howName()
  36. {
  37. cout<<"\n\nAccount Name: "<<myname<<endl;
  38. }
  39. void Bank::EnterNumber()
  40. {
  41. cout<<"Please enter your Account Number: ";
  42. cin>>number;
  43. }
  44. void Bank:howNumber()
  45. {
  46. cout<<"Account No: "<<number<<endl;
  47. }
  48. void Bank::EnterChanges()
  49. {
  50. cout<<"Please enter positive amount to deposit and negative to withdraw: $";
  51. cin>>changes;
  52. }
  53. void Bank:howChanges()
  54. {
  55. cout<<"Enter positive amount to deposit and negative to withdraw: $"<<changes<<endl;
  56. }
  57. void Bank::EnternComputeInitialBal(double ibal)
  58. {
  59. cout<<"Enter inital balance : $"<<ibal<<endl;
  60. }
  61. void Bank::ComputeEndinglBal(double ibal)
  62. {
  63. endingbal=ibal+changes;
  64. cout<<"Ending balance : $"<<endingbal<<endl;
  65. }
  66. void main()
  67. {
  68. Bank bank;
  69. bank.EnterName();
  70. bank.EnterNumber();
  71. bank.EnterChanges();
  72. bank.ShowName();
  73. bank.ShowNumber();
  74. cout<<"Type: Saving "<<endl;
  75. bank.EnternComputeInitialBal(6000);
  76. bank.ShowChanges();
  77. bank.ComputeEndinglBal(6000);
  78. cout<<"Interest next month: $11.67"<<endl;
  79. cout<<"\n\n\n ^_^ Thank you for using this program ^_^ "<<endl;
  80. cout<<" Have a nice day "<<endl;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement