A Pen by ClaudiaInBytes on CodePen.
Last active
August 20, 2017 20:48
-
-
Save claudiainbytes/c97444f0ed667bff578cc5465d8f260f to your computer and use it in GitHub Desktop.
ATM to check your balance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Programming Quiz - Checking Your Balance (3-5) | |
*/ | |
// change the values of `balance`, `checkBalance`, and `isActive` to test your code | |
var balance = 325.00; | |
var checkBalance = true; | |
var isActive = true; | |
// your code goes here | |
if ( checkBalance ) { | |
if ( isActive && balance > 0 ) { | |
console.log("Your balance is $" + balance.toFixed(2) + "."); | |
} else if ( !isActive ) { | |
console.log("Your account is no longer active."); | |
} else if ( balance === 0 ) { | |
console.log("Your account is empty."); | |
} else { | |
console.log("Your balance is negative. Please contact bank."); | |
} | |
} else { | |
console.log("Thank you. Have a nice day!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment