Using a C++ program: You are told to design an interface for a banking machine.
ID: 3817814 • Letter: U
Question
Using a C++ program:
You are told to design an interface for a banking machine. The customer is first asked to enter his Account number and pin. If the pin matches one of four possible pins on the bank (issue) on the card, the customer will be allowed to access the account and is told to “Please proceed.” If the incorrect pin is entered, the customer is allowed to try up to 3 times to enter the correct pin. If he is unsuccessful he will be told by the machine to “See the Bank’s Customer Services Department” and that “This transaction has ended.”
*The four (4) possible pins mentioned in the problem are as follows:
1212, 8864, 3986, 3294.
Explanation / Answer
#include<iostream>
using namespace std;
void main()
{
int acc, pin,count=0;
cout<<"Please enter your Account number: ";
cin>>acc;
label1: cout<<"Enter your pin: ";
cin>>pin;
if(pin == 1212|| pin == 8864|| pin == 3986|| pin == 3294)
{ cout<<" Please Proceed";
return;
}
else
{
cout<<"Incorrect pin! ";
count++; //increment count for number of tries
if(count==4)
goto label2; // for 4 wrong tries
else
goto label1; // for less than 4 wrong tries
}
label2:{ cout<<" See the bank's customer service ";
}
}
//correct pin: 1212, 8864, 3986, 3294.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.