You are tech-entrepreneur venturing into the field of Financial technology and is concerned about the lack financial savings culture among the youth. You have settled on an idea to come up with your own software that allows users to deposit cash for safe keeping and future planning. Whenever a user wants to withdraw money from their accounts, they can visit nearby cash ATM that your company has setup, and withdraw directly by first keying in usernames and passwords. They are also given the option of checking their balance and changing their password. In order to make cash deposits, you have settled on the role of an administrator who will be stationed near an ATM machine, and users will be approaching this administrator to help them make deposits to their accounts. The administrator will log in t using their admin usernames and passwords. They will then be given an option of making a cash deposit for normal users, create an account for new users and also be able to change their administrator passwords.
#include <iostream>
using namespace std;
class ATM{
private:
int balance;
public:
ATM(){
balance=0;
}
void deposit(int amount){
balance=balance+amount;
}
void withdraw(int amount){
balance=balance-amount;
}
void checkBalance(){
cout<<"\nCurrent balance = "<<balance;
}
};
int main()
{
ATM t;
t.checkBalance();
t.deposit(5000);
t.checkBalance();
t.withdraw(1500);
t.checkBalance();
return 0;
}
Comments
Leave a comment