Advertisement
piffy

contobancario

Aug 17th, 2021 (edited)
1,162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. Decommentare questa parte per il testing
  3. exports.init = init
  4. exports.preleva = preleva
  5. exports.versa = versa
  6. exports.estrattoConto = estrattoConto
  7.  
  8. **/
  9.  
  10. var saldo=0,intestatario="";
  11. const limiteScoperto=-500;
  12.  
  13.     function init(nome) {
  14.         intestatario=nome;
  15.         saldo=0;
  16.     }
  17.  
  18.     function preleva(somma){
  19.         if(saldo - somma >= limiteScoperto);{
  20.             saldo -= somma;
  21.             return somma;
  22.         }
  23.     }
  24.  
  25.     function versa(somma){
  26.         saldo + somma;
  27.     }
  28.  
  29.     function estrattoConto() {
  30.         return intestatario+": "+saldo+"€";
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement