C++ Bank account - help!!

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2009
Posts: 9
Reputation: underground111 is an unknown quantity at this point 
Solved Threads: 0
underground111 underground111 is offline Offline
Newbie Poster

C++ Bank account - help!!

 
0
  #1
Jul 30th, 2009
This what I have from my last assignment on creating a bank account. This is what i have to add for the next assignment and I'm lost. Can someone please help me do this!!

Assignment:
1. Create 3 subclasses that inherit from the bank account class created in homework 3. They are Checking, Savings, and CD.

For Checking:
Override the debit method, there is now a per check fee. When we debit money charge a processing fee each time. Account type is “CH”.

For Savings:
Add a private static member for interest rate. Add a method that will calculate the monthly interest and add it to the balance. Also implement a minimum balance check. This should run the same time as the monthly interest, if the account has less than $250, then there is a $5 maintenance fee that should be deducted from the balance.

For CD:
Add a private static member for the interest rate. Add a member to keep track of the number of debits. This account has a limit of 3 withdrawals per year. After the 3rd withdrawal, there is a 2% transaction fee (min $5) for each withdrawal. Add a method that will rollover the account, which indicates that a year has passed, the CD has reached its term, so we will reset the withdrawal count and apply the annual interest rate.

2. Test the new classes as before, create an array of BankAccount objects, assign the elements of the array to new elements of the different classes that we have. Call all of the methods making use of polymorphic behavior that we have for our debit and credit methods.

  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class BankAccount
  6. {
  7.  
  8. private:
  9. static int number;
  10. int AcctNumbr;
  11. string OwnerName;
  12. string Accounttype;
  13. double CurrentBalance;
  14.  
  15. public:
  16. //void BankAccount::withdraw (double amount)
  17. BankAccount(void);
  18. BankAccount( string , double ) ;
  19. void withdraw( double );
  20. double getBalance() const;
  21.  
  22.  
  23. };
  24.  
  25.  
  26. int BankAccount::number = 1001;
  27.  
  28. BankAccount::BankAccount( void )
  29. {
  30.  
  31. }
  32.  
  33.  
  34. BankAccount::BankAccount( string OwnerName, double balance ) // You have an overloaded constructor here but no prototype in class definition
  35. {
  36. cout << "default constructor.";
  37.  
  38.  
  39.  
  40. Accounttype = "GA";
  41. CurrentBalance = balance;
  42. this ->OwnerName = OwnerName;
  43.  
  44.  
  45. }
  46.  
  47. void BankAccount::withdraw (double amount) // Good for debit method but where is it in the class definition?
  48. {
  49. if( amount > 0 && CurrentBalance >= amount )
  50. {
  51. CurrentBalance -= amount;
  52. }
  53. }
  54.  
  55. double BankAccount::getBalance() const
  56. {
  57. return CurrentBalance;
  58. }
  59.  
  60.  
  61. int main ()
  62. {
  63. BankAccount bankList[10];
  64. int nextAcntIndex = 0;
  65. string name;
  66. double balance;
  67. int Accountnumber;
  68. int Withdrawl;
  69.  
  70. cout << " Welcome to World Bank " << endl;
  71.  
  72. int choice;
  73.  
  74.  
  75.  
  76.  
  77. do {
  78. system("cls");
  79. cout << endl;
  80. cout << " United Bank" << endl;
  81. cout << " Select a menu option" << endl;
  82. cout << " 1. Creating an Account" << endl;
  83. cout << " 2. Debt" << endl;
  84. cout << " 3. Current Balance " << endl;
  85. cout << " 4. credit " << endl;
  86. cout << " 5. Exit " << endl;
  87. cout << endl;
  88. cout << " Enter your choice by using the numbers -->> ";
  89. cin >> choice;
  90. cin.clear();
  91. cin.ignore( INT_MAX, '\n' );
  92.  
  93.  
  94. switch( choice ) {
  95. case 1:
  96.  
  97. system( "cls" );
  98. cout << "Enter your name: ";
  99. cin >> name;
  100. cout << "Enter your balance: ";
  101. cin >> balance;
  102.  
  103. bankList[nextAcntIndex] = BankAccount( name, balance);
  104. nextAcntIndex++;
  105.  
  106. break;
  107. case 2:
  108. system( "cls" );
  109. cout << "Enter Account number; ";
  110. cin >> Accountnumber;
  111. cout << "Enter Withdrawl; ";
  112. cin >> Withdrawl;
  113. bankList [Accountnumber - 10001].withdraw ( Withdrawl );
  114.  
  115.  
  116.  
  117. break;
  118. case 3:
  119. cout << " Enter Account number; ";
  120. cin >> Accountnumber;
  121. cout << "Currentbalance" << bankList [Accountnumber - 10001].getBalance ();
  122.  
  123.  
  124. break;
  125. case 4:
  126. cout << "Enter Account number; ";
  127. cin >> Accountnumber;
  128. cout << "Enter balance; ";
  129. cin >> balance;
  130.  
  131. break;
  132. case 5:
  133.  
  134. default:
  135. cout << "That wasn't a choice";
  136. break;
  137. }
  138.  
  139. } while( choice !=5 );
  140.  
  141. return 0;
  142. }
Last edited by John A; Jul 31st, 2009 at 12:36 am. Reason: added code tags
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: C++ Bank account - help!!

 
1
  #2
Jul 31st, 2009
Well, what have you tried so far?
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 9
Reputation: underground111 is an unknown quantity at this point 
Solved Threads: 0
underground111 underground111 is offline Offline
Newbie Poster

Re: C++ Bank account - help!!

 
0
  #3
Jul 31st, 2009
Im a little confused on where to start. I'm not that good with this programming stuff and just need some help on how to do it.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: C++ Bank account - help!!

 
1
  #4
Jul 31st, 2009
Do you know how to use inheritance to derive classes? Start by deriving Checking, Savings, and CD classes from BankAccount.
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 9
Reputation: underground111 is an unknown quantity at this point 
Solved Threads: 0
underground111 underground111 is offline Offline
Newbie Poster

Re: C++ Bank account - help!!

 
0
  #5
Jul 31st, 2009
We just learned about that in class. I can see what i can figure out. And I'll try and put something together.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 9
Reputation: underground111 is an unknown quantity at this point 
Solved Threads: 0
underground111 underground111 is offline Offline
Newbie Poster

Re: C++ Bank account - help!!

 
0
  #6
Aug 2nd, 2009
I can't figure it out. I don't know what to do and the assignment is due tuesday and worth a tonnn of points. Can you please help?
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 9
Reputation: underground111 is an unknown quantity at this point 
Solved Threads: 0
underground111 underground111 is offline Offline
Newbie Poster

Re: C++ Bank account - help!!

 
0
  #7
Aug 3rd, 2009
I only have one more day till this assignment is due. Is there anyone that can help me finish it???
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,837
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 503
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: C++ Bank account - help!!

 
0
  #8
Aug 4th, 2009
You've posted no new code. You have no inheritance in the program and presumably still don't, so presumably you don't understand it yet. You can't do it without it. Your last several posts give no clue about what the problem is, so the only advice one can give is "find a tutorial on inheritance and follow it". Type in "c++ inheritance tutorial". There are lots of them. The only other thing we could do here is simply do it for you and post it, which can't/won't/shouldn't happen.
Last edited by VernonDozier; Aug 4th, 2009 at 1:08 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 1,435
Reputation: firstPerson is just really nice firstPerson is just really nice firstPerson is just really nice firstPerson is just really nice firstPerson is just really nice 
Solved Threads: 186
firstPerson's Avatar
firstPerson firstPerson is offline Offline
Nearly a Posting Virtuoso

Re: C++ Bank account - help!!

 
0
  #9
Aug 4th, 2009
This is how to do inheritance`:

  1. class BankAccount { ... } //base class
  2. class Savings : pubilc BankAccount { ... } //saving derives from base
  3. class Checking : public BankAccount { ... } //checking derives from base
  4. class CD : public BankAccount { ...}

The interface of BankAccount class would be public , so the outside
world would get to use them.

Now you should implement, the needed functions in checkings,
savings and CD class. The needed functions are described in your
notes in the first post.

Continue from this , let me know how it goes.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 9
Reputation: underground111 is an unknown quantity at this point 
Solved Threads: 0
underground111 underground111 is offline Offline
Newbie Poster

Re: C++ Bank account - help!!

 
0
  #10
Aug 4th, 2009
Thank you very much firstPerson that helps out a lot. I looked up inheritance but didn't know how to quite do it. Thanks for the example. I will work on putting in the numbers tonight and post what I have. Once again thank you.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC