Need Help. If can please provide details, thanks. *Create a class called ATM. Th
ID: 3533957 • Letter: N
Question
Need Help. If can please provide details, thanks.*Create a class called ATM. The objects of this class have one attribute: address (i.e. the location of the ATM). The ATM class has a static attribute which is the name of a data file that stores account information in a tabular CSV format. Each row of the table corresponds to single account, where the columns store the following in order - account holder name, account ID, PIN (4 digit numeric password) and total money in the account. The methods of the ATM class should be: the constructor which initializes the address, reads account information from the data file and creates an instance variable which is a list of BankAccount objects; a method called processTransactions. When processTransactions is called it should ask the user for account ID and PIN, then it should respond with either 1) wrong account information or 2) present a menu of choices - check account balance, withdraw, deposit or quit. The method should complete the task chosen and then return to presenting the menu and this should go on until the user chooses to quit. Need Help. If can please provide details, thanks.
*Create a class called ATM. The objects of this class have one attribute: address (i.e. the location of the ATM). The ATM class has a static attribute which is the name of a data file that stores account information in a tabular CSV format. Each row of the table corresponds to single account, where the columns store the following in order - account holder name, account ID, PIN (4 digit numeric password) and total money in the account. The methods of the ATM class should be: the constructor which initializes the address, reads account information from the data file and creates an instance variable which is a list of BankAccount objects; a method called processTransactions. When processTransactions is called it should ask the user for account ID and PIN, then it should respond with either 1) wrong account information or 2) present a menu of choices - check account balance, withdraw, deposit or quit. The method should complete the task chosen and then return to presenting the menu and this should go on until the user chooses to quit.
Explanation / Answer
#include<iostream.h>
class ATM
{
private:
char add[30],name,;
static char acc[30];
int id,pin;
float bal;
public:
ATM()
{
cout<<"enter address ";
cin>>add;
ATM bankaccount;
bankaccount=file.read((*ch)&bankaccount,sizeof(bankaccount));
}
void check_bal()
{
cout<<"Current balance is "<<bal;
}
void withdraw(flaot amt)
{
if(bal<amt)
cout<<"insufficient balance";
else
{
bal=bal-amt;
cout<<"amount is withdraw";
}
}
void deposite(float amt)
{
bal=bal+amt;
cout<<"amount is deposite";
}
};
void main()
{
int id,pin;
atm acc;
cout<<"enter id and pin";
cin>>id>>pin;
if(id==acc.id &&pin==acc.pin)
{
int ch=1;
while(ch!=4)
cout<<"Enter your option 1.check balance 2.withdraw 3.deposite 4.exit;
cin>>ch;
switch()
{
case 1:
acc.check_bal();
break;
case 2:
float amt;
cout<<"enter amount";
cin>>amt;
acc.withdraw(amt);
break;
case 3:
float amt;
cout<<"enter amount to deposite";
cin>>amt;
acc.deposite(amt);
break;
default:
cout<<"enter correct option";
break;
}
}
}
else
{
cout<<"wrong id and Pin";
break;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.