Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. process.stdin.resume()
  2. process.stdin.setEncoding('utf8')
  3.  
  4. class BankCustomer {
  5. constructor (clientName, secretCode) {
  6. let Name = clientName;
  7. let Code = secretCode;
  8. this.getName = function() {
  9. return Name;
  10. }
  11. this.verifyPinInput = function() {
  12. console.log('Welcome '+ this.getName() +'. Please enter your PIN CODE:')
  13. process.stdin.on('data', (enteredCode) => {
  14. if(Number(enteredCode) === Number(Code)) {
  15. console.log(this.getName() + ', the code is CORRECT. ');
  16. } else {
  17. console.log(this.getName() + ', the code is INCORRECT. try again please.');
  18. }
  19. process.exit();
  20. })
  21. }
  22. }
  23. }
  24.  
  25. const customer1 = new BankCustomer('John', '1111');
  26. const customer2 = new BankCustomer('Mary', '9999');
  27.  
  28. customer2.verifyPinInput();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement