4. A bank in your town updates its customers’ accounts at the end of each month. The bank offers two types of accounts: Savings and Checking. Every customer must maintain a minimum balance. If a customer’s balance falls below the minimum balance, there is a service charge of P100.00 for savings accounts and P250.00 for checking accounts. If the balance at the end of the month is at least the minimum balance, the account receives interest as follows:
a.) Savings account receives 4% interest.
b.) Checking accounts with balances of up to P5000 more than the minimum balance receive 3% interest; otherwise, the interest is 5%.
Write a program that will input a customer’s account number (int type), account type (char type; s for savings, c for checking), minimum balance that the account should maintain, and current balance. The program should then output the account number, account type, current balance, and an appropriate message.
(USING IF AND ELSE AND SWITCH ONLY)
using namespace std; //Class Account class Account{ private: string name;//name of user double checkingAccount;//checking Account data double savingAccount;//saving Account data int numberofTransaction; //Number of transaction int input; int acountNumber;//account number public:
//Input data about account void getData(){ cout << "\nEnter name: "; cin >> name; cout<<"Enter 9-digit acount number: "; cin>>acountNumber; } //Return data about account void showData(){ cout <<"\n\nAcount Number: "<<acountNumber;//input account number cout << "\nName: " << name; //input account name cout << "\nCheckingAccount: "<< checkingAccount;// input checking Account cout << "\nSavingAccount: "<< savingAccount; //input saving Account
} //Deposit to account number void Deposit(){ cout << "Which account would you like to deposit to?\n"; cout << "1. Checking Account\n"; cout << "2. Saving Account\n"; cin>> input; if (input == 1) { double checkingAcc; checkingAccount=0;//Initialize checkingAccount savingAccount=0; //Initialize savingAccount cout << "How much do you want to deposit to the Checking Account?\n"; cin >> checkingAcc;//Deposit to checkingAccount checkingAccount+=(checkingAcc-checkingAcc*0.01); cout << "The sum "<<checkingAcc<<" was deposited to the Checking Account\n"; } if (input ==2) { double savingAcco; checkingAccount=0;//Initialize checkingAccount savingAccount=0;//Initialize savingAccoun cout << "How much do you want to deposit to the Saving Account?\n"; cin >>savingAcco; savingAccount+=savingAcco-savingAcco*0.015; //Deposit to savingAccount cout << "The sum "<<savingAcco<<" was deposited to the Saving Account\n"; } } //withdrawal to account number void withdrawal(){ int input; cout << "From which account would you like to withdraw?\n"; cout << "1. Checking\n"; cout << "2. Saving\n"; cin >> input; if (input == 1) { double checkingAcc=0; cout << "How much would you like to withdraw from the Checking account?\n"; cin >> checkingAcc; checkingAccount-=checkingAcc;//withdraw from checking Account
} if (input == 2) { double savingAcco; cout << "How much would you like to withdraw from the Saving account?\n"; cin >>savingAcco; savingAccount-=savingAcco; //withdraw from saving Account } } //Get Saving Account balance double getSavingAccountbalance(){ return savingAccount; } //Get Checking Account balance double getCheckingAccount(){ return checkingAccount; } //Count for transactions double countForTransaction(){ numberofTransaction+=1; } //Get name of account string getName(){ return name; }
int getacountNumber(){ return acountNumber; }
}; //class Savings account class Savings: public Account {
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment