Question: JAVA CODE 01 public class Account 02 { 03 private double balance; 04 private String name; 05 private long acctNum; 06 07 public Account(double initBal,
JAVA CODE
01 public class Account
02 {
03 private double balance;
04 private String name;
05 private long acctNum;
06
07 public Account(double initBal, String owner, long number)
08 {
09 balance = initBal;
10 name = owner;
11 acctNum = number;
12 }
13
14 public void withdraw(double amtToTake)
15 {
16 balance -= amtToTake;
17 }
18
19 public void deposit(double amtToAdd)
20 {
21 balance += amtToAdd;
22 }
23
24 public double getBalance()
25 {
26 return balance;
27 }
28
29 public String toString()
30 {
31 String s = "Acct:" + acctNum;
32 s += " owner:" + name;
33 s += " Bal:$" + balance;
34 return s;
35 }
36}
QUESTION 1
What is the line number for the header of the constructor?
QUESTION 2
Which of the following are accessors?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| There are no accessors |
QUESTION 3
Which of the following are actual parameters (also called arguments)?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| There are no actual parameters |
QUESTION 4
Which of the following are instance variables for an Account object?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| Account objects have no instance variables |
QUESTION 5
Which of the following are members of the class Account?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| The Account class has no members. |
QUESTION 6
Which of the following are formal parameters (also called parameters)?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| There are no formal parameters |
QUESTION 7
Which of the following provide the behavior of an Account object?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| Account objects have no behavior |
QUESTION 8
Which of the following comprise the state of an Account object?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| Account objects have no state |
QUESTION 9
Which of the following are mutators?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| There are no mutators |
QUESTION 10
Which of the following are local data (local variables)?
|
| balance | |
|
| name | |
|
| acctNum | |
|
| initBal | |
|
| owner | |
|
| number | |
|
| withdraw | |
|
| amtToTake | |
|
| deposit | |
|
| amtToAdd | |
|
| getBalance | |
|
| toString | |
|
| s | |
|
| There are no local variables |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
