Which methods of the Account class cannot be seen or called from the AccountTest
ID: 641570 • Letter: W
Question
Which methods of the Account class cannot be seen or called from the AccountTester class? (Check all that apply.)
Question 23 options:
showMessage (line 94 of Listing 1).
displayValues (line 63 of Listing 1).
getBalance (line 53 of Listing 1).
futureValue (line 84 of Listing 1).
Listing 1 below:
3 public class Account
4 {
5 private double balance;
6 private int credits;
7 private int debits;
8 private double totalCredits;
9 private double totalDebits;
10 public static final double CURRENT_RATE = 0.045;
11
12 public Account(double initialBalance)
13 {
14 if( initialBalance >= 0.0 )
15 balance = initialBalance;
16 else
17 showMessage("? Incorrect initial balance: $%.2f ", initialBalance);
18 }
19
20 public Account(Account fromAccount)
21 {
22 balance = fromAccount.getBalance();
23 }
24
25 public void credit(double amount)
26 {
27 if( amount > 0.0 )
28 {
29 balance += amount;
30 totalCredits += amount;
31 credits++;
32 }
33 else
34 showMessage("? Invalid amount for a Credit: $%.2f ", amount);
35 }
36
37 public void debit(double amount)
38 {
39 if( amount > 0.0 )
40 if( balance >= amount )
41 {
42 balance = balance - amount;
43 totalDebits = totalDebits + amount;
44 debits++;
45 }
46 else
47 showMessage("? Debit of $%.2f exceeds balance of $%.2f", amount,
48 balance);
49 else
50 showMessage("? Invalid amount for a Debit: $%.2f ", amount);
51 }
52 CSC-240 Java Programming
showMessage (line 94 of Listing 1).
displayValues (line 63 of Listing 1).
getBalance (line 53 of Listing 1).
futureValue (line 84 of Listing 1).
Listing 1 below:
3 public class Account
4 {
5 private double balance;
6 private int credits;
7 private int debits;
8 private double totalCredits;
9 private double totalDebits;
10 public static final double CURRENT_RATE = 0.045;
11
12 public Account(double initialBalance)
13 {
14 if( initialBalance >= 0.0 )
15 balance = initialBalance;
16 else
17 showMessage("? Incorrect initial balance: $%.2f ", initialBalance);
18 }
19
20 public Account(Account fromAccount)
21 {
22 balance = fromAccount.getBalance();
23 }
24
25 public void credit(double amount)
26 {
27 if( amount > 0.0 )
28 {
29 balance += amount;
30 totalCredits += amount;
31 credits++;
32 }
33 else
34 showMessage("? Invalid amount for a Credit: $%.2f ", amount);
35 }
36
37 public void debit(double amount)
38 {
39 if( amount > 0.0 )
40 if( balance >= amount )
41 {
42 balance = balance - amount;
43 totalDebits = totalDebits + amount;
44 debits++;
45 }
46 else
47 showMessage("? Debit of $%.2f exceeds balance of $%.2f", amount,
48 balance);
49 else
50 showMessage("? Invalid amount for a Debit: $%.2f ", amount);
51 }
52 CSC-240 Java Programming
Explanation / Answer
showMessage (line 94 of Listing 1).
Because this method is declared private, so it cannont be called in the tester class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.