-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path[Objects.method()] Bank Accounts 1 (7-3)
More file actions
33 lines (30 loc) · 1.1 KB
/
[Objects.method()] Bank Accounts 1 (7-3)
File metadata and controls
33 lines (30 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Programming Quiz: Bank Accounts 1 (7-3)
*/
/*
* QUIZ REQUIREMENTS
* - Your code should have an object `savingsAccount`
* - Your `savingsAccount` object should have the `balance` and `interestRatePercent` property
* - Your `savingsAccount` object should have a `printAccountSummary()` method
* - Your `printAccountSummary()` method should return the EXACT expected message
* - BE CAREFUL ABOUT THE PUNCTUATION, SPACES, AND EXACT WORDS TO BE PRINTED.
*/
var savingsAccount = {
balance: 1000,
interestRatePercent: 1,
deposit: function addMoney(amount) {
if (amount > 0) {
savingsAccount.balance += amount;
}
},
withdraw: function removeMoney(amount) {
var verifyBalance = savingsAccount.balance - amount;
if (amount > 0 && verifyBalance >= 0) {
savingsAccount.balance -= amount;
}
},
printAccountSummary: function(){
return "Welcome!\nYour balance is currently $"+savingsAccount.balance+" and your interest rate is "+savingsAccount.interestRatePercent+"%.";
}
};
console.log(savingsAccount.printAccountSummary());