Solved

Consider the Following Code Snippet

Question 50

Multiple Choice

Consider the following code snippet:
Public class BankAccount
{
Private int transactionCount;
Private double balance;
) . .
}
Which of the following deposit methods would correctly track how many deposits occurred?


A) public void deposit(double amount)
{
Balance = balance + amount;
}
B) public void deposit(double amount)
{
Balance = balance + amount;
TransactionCount ++;
}
C) public void deposit(double amount)
{
Balance = balance + amount;
TransactionCount = transactionCount + amount;
}
D) public void deposit(double amount)
{
Balance = transactionCount + amount;
}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions