$12.00 Programming Help with C++
- This tutorial hasn't been purchased yet.
- Posted on Feb 23, 2009 at 11:29:43PM
A:
Preview: ... <br>I have co ...
The full tutorial is about 7 words long plus attachments.
Attachments:
bank.zip (1K)
$12.00 Class Tutorial
- This tutorial hasn't been purchased yet.
- Posted on Feb 23, 2009 at 6:25:42PM
A:
Preview: ... to follow, and modify.<br>I wrote the program only for one deposit and one withdraw,<br>you can modify it to do many, you could use a do-while loop and/or arrays.<br>You can work with the base class independently of the derived class. The derive class uses function of the base class,so you need it, in order to work with this c ...
The full tutorial is about 264 words long plus attachments.
Attachments:
bank.zip (10K)
$12.00 C++ Bank Account Inheritance program. Lots Of Attributes. Lots Of Comments. Compiles With MS Visual Studio C++ 2008.
- This tutorial was purchased 4 times and rated A+ by students like you.
- Posted on Feb 24, 2009 at 1:13:15PM
A:
Preview: ... matter which class<br> //or object it is used in.<br> static const double interestRate; <br><br>};<br><br>const double BankAccount::interestRate = 0.01; //set the rate wqual to 1%<br><br>BankAccount::BankAccount(string f, string l, int n, double amount)<br>{<br> firstName = f;<br> lastName = l;<br> accountNumber = n;<br> balance = amount;<br>}<br><br>string BankAccount::getName()<br>{<br> //returns a full string of the name for example if the first name is John and the last<br> //name is Doe it will return the string "John Doe".<br> string name = firstName + " " + lastName;<br> return name;<br>}<br><br>void BankAccount::setName(string f, string l)<br>{<br> firstName = f;<br> lastName = l;<br>}<br><br>int BankAccount::getAccountNumber()<br>{<br> return accountNumber;<br>}<br><br>void BankAccount::setBalance(double bal)<br>{<br> balance = bal;<br>}<br><br>double BankAccount::getBalace()<br>{<br> return balance;<br>}<br><br>void BankAccount::deposit(double amount)<br>{<br> balance += amount;<br>}<br><br>void BankAccount::addInterest()<br>{<br> //calculate the interest on the balance. It is divided by 12 because rates<br> //are usually set in years and banks do the calculation once a month.<br> double interest = (interestRate / 12.0) * balance;<br> balance += interest;<br>}<br><br>void BankAccount::withdraw(double amount, WITHDRAWL_TYPE type)<br>{<br> /*<br> If the bank account will go below $0.00 if this amount is withdrawn then the<br> bank teller will warn them that they cannot take this amount away from the <br> account and not do it. If it doesn't go below $0.00 they will take it out<br> of the balance.<br> */<br> if (balance - amount < 0)<br> {<br> cout << "Bank Teller: balance cannot go below $0.00.";<br> cout << endl;<br> }<br> else<br> balance -= amount;<br>}<br><br>void BankAccount::monthlyUpdate()<br>{<br> addInterest();<br>}<br><br>void BankAccount::displayInformation()<br>{<br> cout << "Savings ACCT #" << accountNumber << ", " << getName() << " has a balance of $" << balance;<br> cout << endl;<br>}<br><br>/*<br> A checking account is similar to a savings account in that it holds money which can<br> be added to or taken away from. Unlike a savings account, which is used for long term<br> savings, money is constantly being added to it and taken ...
The full tutorial is about 1413 words long plus attachments.
Attachments:
main.cpp (10K) (Preview)