Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- process.stdin.resume()
- process.stdin.setEncoding('utf8')
- class BankCustomer {
- constructor (clientName, secretCode) {
- let Name = clientName;
- let Code = secretCode;
- this.getName = function() {
- return Name;
- }
- this.verifyPinInput = function() {
- console.log('Welcome '+ this.getName() +'. Please enter your PIN CODE:')
- process.stdin.on('data', (enteredCode) => {
- if(Number(enteredCode) === Number(Code)) {
- console.log(this.getName() + ', the code is CORRECT. ');
- } else {
- console.log(this.getName() + ', the code is INCORRECT. try again please.');
- }
- process.exit();
- })
- }
- }
- }
- const customer1 = new BankCustomer('John', '1111');
- const customer2 = new BankCustomer('Mary', '9999');
- customer2.verifyPinInput();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement