Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

add a data type class Account_yourLastName and a driver class BankService_yourLa

ID: 3746924 • Letter: A

Question

add a data type class Account_yourLastName and a driver class BankService_yourLastName

DATA TYPE CLASS: Provide UML and the code of data type class Account_yourLastName to hold the information of an account with account number(String), customer name(String), balance(double) with no-argument constructor, parameter constructor

Also, define some methods to handle the tasks: open account, check current balance, deposit, withdraw, and print monthly statement

OPEN ACCOUNT-display the output: (for example with account last name, account first name, account number is 1567794657, and balance is 500)

Account Name: customer name

Account Number: 1567794657

New Account balance: 500.0

CHECK BALANCE

Display the output as belows: (for example current balance is 500)

Account Name: customer name

Account Number: 1567794657

Current Balance: 500.0

DEPOSIT-Calculate the new balnce then display output (if deposit amount is 200)

Account Name:

Account Number: 1567794657

Deposit amount: 200.0

New Balance: 700.0

WITHDRAW-Calculate new balance then display the message(for example withdraw amount is 300)

Account Name:

Account Number: 1567794657

Withdraw amount: 300.0

New Balance: 400.0

PRINT MONTHLY STATEMENT-dIsplay the following output:

Account Name:

Account Number: 1567794657

End Balance: 400.0

DRIVER CLASS: provide the pseudo-code or flowchart then write the code for the BankService_yourLastName to provide the application of a bank service that provide the following menu of tasks:

MAIN MENU

1.Open new account

2.Check current balance

3.Deposit

4.Withdraw

5.Print monthly statement

0.Exit

Task 1: Open new account:

- After reading all information of customer entered from the keyboard to create an account

-Ask for the money amount down to open account.

-then display the output as by calling the method open account from class

Account_yourLastName

FROM TASK2 TO TASK5, IF THE ACCOUNT IS NOT OPEN YET, DISPLAY MESSAGE “YOU HAVE TO OPEN ACCOUNT BEFORE SELECTING THIS TASK” THEN CALL THE TASK 1 TO OPEN NEW ACCOUNT

Task 2: Check current balance

-use the current account to call method from the data type classs to display message about the current balance

Task 3: Deposit

-Ask how much users want to deposit then call the method deposit of class Account_yourLastName

Task 4: Withdraw

-Ask how much users want to withdraw then call the method withdraw of class Account_yourLastName

Task 5: Print monthly statement

-call the method print monthly statement of class Account_yourLastName

EXIT

When users exit display the message box:

“Thank you. The application is terminating..”

Explanation / Answer

Below is the C++ code I hope that i have provided sufficient comments for your better understanding Note that I have done proper indentation but this code is automatically left alligned on this interface

#include <bits/stdc++.h>
using namespace std;
class Account
{
private:
string acc_no,customer_name;
double balance;
public:
Account() //Constructor with no parameters
{
acc_no="";
customer_name="";
balance=0.0;
}
Account(string a_no,string c_name,double bal) //Parameterized Constructor
{
acc_no=a_no;
customer_name=c_name;
balance=bal;
}
void setAccountNo(string a_no)
{
acc_no=a_no;
}
void setCustomerName(string c_name)
{
customer_name=c_name;
}
void setBalance(double bal)
{
balance=bal;
}
string getAccountNo()
{
return acc_no;
}
string getCustomerName()
{
return customer_name;
}
double getBalance()
{
return balance;
}
};

vector <Account>v; //Global variable to store information of all customers

void open_account(string a_no,string c_name,double bal)
{
Account temp;

//set the variables accordingly
temp.setAccountNo(a_no);
temp.setCustomerName(c_name);
temp.setBalance(bal);

//Display the output
cout<<"Account name: "<<c_name<<endl;
cout<<"Account Number: "<<a_no<<endl;
cout<<"New account Balance: "<<bal<<endl;

v.push_back(temp);
}
void checkbalance(string a_no)
{
int i;
string name,no;
double bal;
for(i=0;i<v.size();i++)
{
if((v[i].getAccountNo())==a_no)
{
cout<<"Account name: "<<v[i].getCustomerName()<<endl;
cout<<"Account Number: "<<a_no<<endl;
cout<<"Current Balance: "<<v[i].getBalance()<<endl;
break;
}
}
if(i==v.size()) //Account do not exist
{
cout<<"You first need to create an account"<<endl;
cout<<"Enter your name: ";
cin>>name;
cout<<"Enter 10 digit account number: ";
cin>>no;
cout<<"Enter your initial deposit: ";
cin>>bal;
open_account(no,name,bal);
}
}

void deposit(string a_no,double bal)
{
int i;
string name,no;
for(i=0;i<v.size();i++)
{
if((v[i].getAccountNo())==a_no)
{
cout<<"Account name: "<<v[i].getCustomerName()<<endl;
cout<<"Account Number: "<<a_no<<endl;
cout<<"Deposit Amount: "<<bal<<endl;
v[i].setBalance(v[i].getBalance()+bal);
cout<<"New Balance: "<<v[i].getBalance()<<endl;
break;
}
}
if(i==v.size()) //Account do not exist
{
cout<<"You first need to create an account"<<endl;
cout<<"Enter your name: ";
cin>>name;
cout<<"Enter 10 digit account number: ";
cin>>no;
cout<<"Enter your initial deposit: ";
cin>>bal;
open_account(no,name,bal);
}
}
void withdraw(string a_no,double bal)
{
int i;
string name,no;
for(i=0;i<v.size();i++)
{
if((v[i].getAccountNo())==a_no)
{
cout<<"Account name: "<<v[i].getCustomerName()<<endl;
cout<<"Account Number: "<<a_no<<endl;
cout<<"Withdraw Amount: "<<bal<<endl;
v[i].setBalance(v[i].getBalance()-bal);
cout<<"New Balance: "<<v[i].getBalance()<<endl;
break;
}
}
if(i==v.size()) //Account do not exist
{
cout<<"You first need to create an account"<<endl;
cout<<"Enter your name: ";
cin>>name;
cout<<"Enter 10 digit account number: ";
cin>>no;
cout<<"Enter your initial deposit: ";
cin>>bal;
open_account(no,name,bal);
}
}
void PrintMonthlyStatement(string a_no)
{
int i;
string name,no;
double bal;
for(i=0;i<v.size();i++)
{
if(v[i].getAccountNo()==a_no)
{
cout<<"Account name: "<<v[i].getCustomerName()<<endl;
cout<<"Account Number: "<<a_no<<endl;
cout<<"End Balance: "<<v[i].getBalance()<<endl;
break;
}
}
if(i==v.size()) //Account do not exist
{
cout<<"You first need to create an account"<<endl;
cout<<"Enter your name: ";
cin>>name;
cout<<"Enter 10 digit account number: ";
cin>>no;
cout<<"Enter your initial deposit: ";
cin>>bal;
open_account(no,name,bal);
}
}

int main()
{
int choice;
string name,no;
double bal;
cout<<"1.Open new account"<<endl;

cout<<"2.Check current balance"<<endl;

cout<<"3.Deposit"<<endl;

cout<<"4.Withdraw"<<endl;

cout<<"5.Print monthly statement"<<endl;

cout<<"0.Exit"<<endl;
while(1)
{
cout<<"Enter your choice: ";
cin>>choice;
switch(choice)
{
case 0:
exit(0);
case 1:
cout<<"Enter your name: ";
cin>>name;
cout<<"Enter 10 digit account number: ";
cin>>no;
cout<<"Enter your initial deposit: ";
cin>>bal;
open_account(no,name,bal);
break;
case 2:
cout<<"Enter you account number: ";
cin>>no;
checkbalance(no);
break;
case 3:
cout<<"Enter 10 digit account number: ";
cin>>no;
cout<<"Enter deposit amount: ";
cin>>bal;
deposit(no,bal);
break;
case 4:
cout<<"Enter 10 digit account number: ";
cin>>no;
cout<<"Enter amount you wish to withdraw: ";
cin>>bal;
withdraw(no,bal);
break;
case 5:
cout<<"Enter 10 digit account number: ";
cin>>no;
PrintMonthlyStatement(no);
break;
}
}
return 0;
}

Hope i have answered your question satisfactorily.Leave doubts in comment section if any.