Fall 2016 Computer Programming I1TesttV class BankAcvount on
Fall 2016 Computer Programming I1-TesttV class BankAcvount on the last page of the test : sa What sets printed after we execute the following code (4 pts) sankAccount a-new BankAccount (60\"Jenniter\") askAccount b-new BankAccount 70 \"Hala\") What gets printed after we execute the following code (4 pts) BankAccount a -new BankAccount) a update (23, \"Nora\") : System.out printin (a): What gets printed after we execute the following code (4 pts) BankAccount a-new BankAccount a. update (270,\"Clinton\") BankAccount b = a b.update (89.\"Trump\") i System.out.println (a.printMe)) AAI
Solution
Please follow the code and comments for description :
a) CODE :
BankAccount a = new BankAccount(60, \"Jennifer\");
BankAccount b = new BankAccount(70, \"Hala\");
OUTPUT :
null
5.0
null
5.0
b) CODE :
BankAccount a = new BankAccount();
a.update(23, \"Nora\");
System.out.println(a);
OUTPUT :
Account : 917
balance : 23.0
c) CODE :
BankAccount a = new BankAccount();
a.update(270, \"Clinton\");
BankAccount b = a;
b.update(89, \"Trump\");
a.printMe();
OUTPUT :
917
89.0
NOTE : As the last line of the code tells to print the output of the method printMe() which is a void type this has been set to method call so as to get the data to console.
Hope this is helpful.
