Skip to content

Instantly share code, notes, and snippets.

@claudiainbytes
Last active August 20, 2017 20:48
Show Gist options
  • Save claudiainbytes/c97444f0ed667bff578cc5465d8f260f to your computer and use it in GitHub Desktop.
Save claudiainbytes/c97444f0ed667bff578cc5465d8f260f to your computer and use it in GitHub Desktop.
ATM to check your balance
/*
* 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