Ans. program code :
#include<iostream>
#include<stdlib.h>
using namespace std;
class bank
{
int ac,bal;
static int reset_t;
float balance, amount, shorta;
public:
// declaring methods
void deposit();
void withdraw();
void chkbalance();
void interestRate();
int menu();
};
int bank::reset_t=0;
//defining the methods
void bank::deposit()
{
cout<<"\n Enter Account Number:";
cin>>ac;
if(ac==1001)
{
cout<<"\nEnter Amount you want to Deposit:";
cin>>amount;
balance=balance+amount;
cout<<"\n\nMessage: You have successfully deposited
Rs."<<amount<<" into your account.\n\nYour Current
Balance is:"<<balance<<"\n\n";
reset_t++;
}
else
{
cout<<"You have entered invalid account number";
}
}
void bank::withdraw()
{
cout<<"Enter Account Number:";
cin>>ac;
if(ac==1001)
{
cout<<"Enter Amount you want to Withdraw:";
cin>>amount;
if(amount>balance)
{
shorta=amount-balance;
cout<<"\n\nYou cannot withdraw Rs."<<amount<<" as
your account balance is Rs."<<balance<<"\n\nYou are
short of Rs."<<shorta;
}
else
{
balance=balance-amount;
cout<<"You have Withdrawn Rs."<<amount<<"
Successfully\n\n Your account balance
is:"<<balance<<"\n\n";
}
}
else
{
cout<<"You have entered invalid account number";
}
}
void bank::chkbalance()
{
cout<<"Enter Account Number:";
cin>>ac;
if(reset_t==0)
{
balance=0;
}
if(ac==1001)
{
cout<<"Your Account balance is
Rs."<<balance<<"\n\n";
}
else
{
cout<<"Account Doesn't Exist!!";
}
}
void bank::interestRate()
{
cout<<"Enter Account Number:";
cin>>ac;
if(reset_t==0)
{
balance=0;
}
if(ac==1001)
{
cout<<"Your Account balance is
Rs."<<2*balance<<"\n\n";
}
else
{
cout<<"Account Doesn't Exist!!";
}
}
int main()
{
bank ob;
int ch,value;
//showing the type of account
cout<<"\n enter the type of account";
cout<<"\n 1: savings";
cout<<"\n 2: checking account";
cout<<"\n 3: money market account";
cout<<"\n";
cin>>value;
do {
//dispalying menu to user
cout<<"\n\n\n1.Deposit\n2.Withdraw\n3.Balance
Enquiry\n4.calculate interest\n5.Exit\n\n";
ch=ob.menu();
switch(ch)
{
case 1:ob.deposit(); // case for depositing amount
break;
case 2:ob.withdraw(); //case for withdrawing amount
break;
case 3:ob.chkbalance(); //case to check balance
break;
case 4: ob.interestRate(); //case to find teh interest rate
break;
case 5: exit(1);
default:cout<<"Invalid Choice!!"; //showing default message
to user
}
}while(1);
}
int bank::menu()
{
int ch;
cout<<"\nEnter your Choice:";
cin>>ch;
return ch;
}
output:
each of the data attributes. b. Accessor and mutator methods for each data attribute. An ..str method that returns a string indicating the state of the object 3. Look at the following description...
Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of 100 accounts. Use an array of pointers to objects for this. However, your...
Programming Assignment 5: UML Diagram Objectives: After successfully completing this assignment, students will practice Object Oriented design by creating an UML diagram for a Java program. Program Statement: Bank System You were asked to create a simple UML diagram for a bank system. Each bank has a specific identification number, a name, and a location that needs to be stored. Tellers serve customers’ loans, checking and savings accounts. The bank must know each tellers’ name and identification number for record...
Need some help with this C++ code. Please screenshot the code if possible. Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of...