#include #include using namespace std; //define class & its public/private members class bankAccount { public: setAccountNumber(int); setAccountBalance(double); putMoneyIn(double); takeMoneyOut(double); const void const void const void const void void printAccountInfo(); private: int accountNumber; double accountBalance; int main() //run all the functionas bankAccount account1; account1.setAccountNumber(123456); account1.setAccountBalance(10000); account1.printAccountInfo(); account1.takeMoneyOut(200); cout << "Your information after withdrawling $200 is as follows"; cout << endl; account1.printAccountInfo(); account1.putMoneyIn(1293); cout << "Your information after depositing $1293 is as follows"; cout << endl; account1.printAccountInfo(); system("pause"); return 0; } //set the account # const void bankAccount::setAccountNumber(int num) }; { { }; accountNumber = num; //set a starting balance const void bankAccount::setAccountBalance(double bal) { accountBalance = bal; }; //deposit money void const bankAccount::putMoneyIn(double amount) { accountBalance += amount; }; //withdraw money const void bankAccount::takeMoneyOut(double amount) { if (amount > accountBalance) { std::endl; } { } } accountBalance -= amount; std::cout << "You have insufficient funds for this withdrawl." << else //show account # & balance void bankAccount::printAccountInfo() { }; cout << "Your account number is #" << accountNumber << endl; cout << "Your account balance is $" << accountBalance << endl; Modify the above code in C++ to add a savings and a checkings account. I need help defining each function and each class. Every bank offers a checking account. Derive the class checkingAccount from the class bankAccount (designed above). This class inherits members to store the account number and the balance from the base class. A customer with a checking account typically receives interest, maintains a minimum balance, and pays service charges if the balance falls below the minimum balance. Add member variables to store this additional information. In addition to the operations inherited from the base class, this class should provide the following operations: set interest rate, retrieve interest rate, set minimum balance, retrieve minimum balance, set service charges, retrieve service charges, post interest, verify if the balance is less than the minimum balance, write a check, withdraw (override the method of the base class), and print account information. Add appropriate constructors. Every bank offers a savings account. Derive the class savingsAccount from the class bankAccount (designed above). This class inherits members to store the account number and the balance from the base class. A customer with a savings account typically receives interest, makes deposits, and withdraws money. In addition to the operations inherited from the base class, this class should provide the following operations: set interest rate, retrieve interest rate, post interest, withdraw (override the method of the base class), and print account information. Add appropriate constructors.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
#include <iostream> #include <string> using namespace std;
//define class & its public/private members
class bankAccount {
public:
setAccountNumber(int); setAccountBalance(double); putMoneyIn(double); takeMoneyOut(double);
const void
const void
const void
const void
void printAccountInfo();
private:
int accountNumber;
double accountBalance; int main()
//run all the functionas
bankAccount account1; account1.setAccountNumber(123456); account1.setAccountBalance(10000); account1.printAccountInfo(); account1.takeMoneyOut(200);
cout << "Your information after withdrawling $200 is as follows"; cout << endl;
account1.printAccountInfo();
account1.putMoneyIn(1293);
cout << "Your information after depositing $1293 is as follows"; cout << endl;
account1.printAccountInfo();
system("pause");
return 0; }
//set the account #
const void bankAccount::setAccountNumber(int num)
}; {
{
};
accountNumber = num;
//set a starting balance
const void bankAccount::setAccountBalance(double bal) {
accountBalance = bal;
};
//deposit money
void const bankAccount::putMoneyIn(double amount) {
accountBalance += amount;
};
//withdraw money
const void bankAccount::takeMoneyOut(double amount) {
if (amount > accountBalance) {
std::endl; }
{
} }
accountBalance -= amount;
std::cout << "You have insufficient funds for this withdrawl." << else
//show account # & balance
void bankAccount::printAccountInfo() {
};
cout << "Your account number is #" << accountNumber << endl; cout << "Your account balance is $" << accountBalance << endl;
Modify the above code in C++ to add a savings and a checkings account. I need help defining each function and each class.
Every bank offers a checking account. Derive the class checkingAccount from the class bankAccount (designed above). This class inherits members to store the account number and the balance from the base class. A customer with a checking account typically receives interest, maintains a minimum balance, and pays service charges if the balance falls below the minimum balance. Add member variables to store this additional information. In addition to the operations inherited from the base class, this class should provide the following operations: set interest rate, retrieve interest rate, set minimum balance, retrieve minimum balance, set service charges, retrieve service charges, post interest, verify if the balance is less than the minimum balance, write a check, withdraw (override the method of the base class), and print account information. Add appropriate constructors.
Every bank offers a savings account. Derive the class savingsAccount from the class bankAccount (designed above). This class inherits members to store the account number and the balance from the base class. A customer with a savings account typically receives interest, makes deposits, and withdraws money. In addition to the operations inherited from the base class, this class should provide the following operations: set interest rate, retrieve interest rate, post interest, withdraw (override the method of the base class), and print account information. Add appropriate constructors.
Step by step
Solved in 4 steps with 4 images
How would I add the minimun balance functions and service charges? Also include write. check? How would I add deposit money? Can you add it to your code so I can see where everything is supposed to go?